From 3c44a59f16acb128af8c8194901183ca49fce42f Mon Sep 17 00:00:00 2001 From: Sergei Petrosian Date: Wed, 12 Feb 2025 11:39:43 +0100 Subject: [PATCH] ci: Check spelling with codespell * You can ignore words inline by adding a comment like `# codespell:ignore word`. * You can ignore words by adding them to the `.codespell_ignores` file. * You can ignore files and directories by adding them with `skip = ` to the `.codespellrc` file. Signed-off-by: Sergei Petrosian --- .codespell_ignores | 1 + .codespellrc | 8 +++ .github/workflows/codespell.yml | 17 ++++++ README.md | 58 +++++++++---------- library/network_connections.py | 4 +- .../network_lsr/argument_validator.py | 2 +- module_utils/network_lsr/nm/client.py | 2 +- pylintrc | 2 +- scripts/print_all_options.py | 2 +- tests/playbooks/tests_checkpoint_cleanup.yml | 2 +- tests/tasks/manage_test_interface.yml | 2 +- 11 files changed, 63 insertions(+), 37 deletions(-) create mode 100644 .codespell_ignores create mode 100644 .codespellrc create mode 100644 .github/workflows/codespell.yml diff --git a/.codespell_ignores b/.codespell_ignores new file mode 100644 index 00000000..26f3b3d2 --- /dev/null +++ b/.codespell_ignores @@ -0,0 +1 @@ +iif diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..45622449 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,8 @@ +[codespell] +check-hidden = true +# Note that `-w` doesn't work when ignore-multiline-regex is set +# https://github.com/codespell-project/codespell/issues/3642 +ignore-multiline-regex = "codespell:ignore-begin.*codespell:ignore-end" +ignore-words = .codespell_ignores +# skip-file is not available https://github.com/codespell-project/codespell/pull/2759 +skip = ./tests/files/client.key.nocrypt,./tests/files/client.pem diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..8eadb612 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,17 @@ +# Codespell configuration is within .codespellrc +--- +name: Codespell +on: # yamllint disable-line rule:truthy + - pull_request +permissions: + contents: read +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/README.md b/README.md index 0e4a4258..70013315 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # linux-system-roles/network -[![ansible-lint.yml](https://github.com/linux-system-roles/network/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/ansible-lint.yml) [![ansible-test.yml](https://github.com/linux-system-roles/network/actions/workflows/ansible-test.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/ansible-test.yml) [![codeql.yml](https://github.com/linux-system-roles/network/actions/workflows/codeql.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/codeql.yml) [![integration.yml](https://github.com/linux-system-roles/network/actions/workflows/integration.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/integration.yml) [![markdownlint.yml](https://github.com/linux-system-roles/network/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/markdownlint.yml) [![python-unit-test.yml](https://github.com/linux-system-roles/network/actions/workflows/python-unit-test.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/python-unit-test.yml) [![shellcheck.yml](https://github.com/linux-system-roles/network/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/shellcheck.yml) [![tft.yml](https://github.com/linux-system-roles/network/actions/workflows/tft.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/tft.yml) [![tft_citest_bad.yml](https://github.com/linux-system-roles/network/actions/workflows/tft_citest_bad.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/tft_citest_bad.yml) [![woke.yml](https://github.com/linux-system-roles/network/actions/workflows/woke.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/woke.yml) [![Coverage Status](https://coveralls.io/repos/github/linux-system-roles/network/badge.svg)](https://coveralls.io/github/linux-system-roles/network) [![Code Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/linux-system-roles/network.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/linux-system-roles/network/context:python) +[![ansible-lint.yml](https://github.com/linux-system-roles/network/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/ansible-lint.yml) [![ansible-test.yml](https://github.com/linux-system-roles/network/actions/workflows/ansible-test.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/ansible-test.yml) [![codeql.yml](https://github.com/linux-system-roles/network/actions/workflows/codeql.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/codeql.yml) [![codespell.yml](https://github.com/linux-system-roles/network/actions/workflows/codespell.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/codespell.yml) [![integration.yml](https://github.com/linux-system-roles/network/actions/workflows/integration.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/integration.yml) [![markdownlint.yml](https://github.com/linux-system-roles/network/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/markdownlint.yml) [![python-unit-test.yml](https://github.com/linux-system-roles/network/actions/workflows/python-unit-test.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/python-unit-test.yml) [![shellcheck.yml](https://github.com/linux-system-roles/network/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/shellcheck.yml) [![tft.yml](https://github.com/linux-system-roles/network/actions/workflows/tft.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/tft.yml) [![tft_citest_bad.yml](https://github.com/linux-system-roles/network/actions/workflows/tft_citest_bad.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/tft_citest_bad.yml) [![woke.yml](https://github.com/linux-system-roles/network/actions/workflows/woke.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/woke.yml) [![Coverage Status](https://coveralls.io/repos/github/linux-system-roles/network/badge.svg)](https://coveralls.io/github/linux-system-roles/network) [![Code Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/linux-system-roles/network.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/linux-system-roles/network/context:python) ## Overview @@ -480,7 +480,7 @@ In general these work like shell globs. - `*`, matches zero or more of any character - `?`, matches any single character -- `[fo]` - matches any single `f` or `o` character - also supports ranges - `[0-9]` +- `[fo]` - matches any single `f` or `o` character - also supports ranges - `[0-9]` will match any single digit character ### `path` @@ -788,31 +788,31 @@ The ethtool configuration supports the following options: coalesce: adaptive_rx: true|false # optional adaptive_tx: true|false # optional - pkt_rate_high: 0 # optional mininum=0 maximum=0xffffffff - pkt_rate_low: 0 # optional mininum=0 maximum=0xffffffff - rx_frames: 0 # optional mininum=0 maximum=0xffffffff - rx_frames_high: 0 # optional mininum=0 maximum=0xffffffff - rx_frames_irq: 0 # optional mininum=0 maximum=0xffffffff - rx_frames_low: 0 # optional mininum=0 maximum=0xffffffff - rx_usecs: 0 # optional mininum=0 maximum=0xffffffff - rx_usecs_high: 0 # optional mininum=0 maximum=0xffffffff - rx_usecs_irq: 0 # optional mininum=0 maximum=0xffffffff - rx_usecs_low: 0 # optional mininum=0 maximum=0xffffffff - sample_interval: 0 # optional mininum=0 maximum=0xffffffff - stats_block_usecs: 0 # optional mininum=0 maximum=0xffffffff - tx_frames: 0 # optional mininum=0 maximum=0xffffffff - tx_frames_high: 0 # optional mininum=0 maximum=0xffffffff - tx_frames_irq: 0 # optional mininum=0 maximum=0xffffffff - tx_frames_low: 0 # optional mininum=0 maximum=0xffffffff - tx_usecs: 0 # optional mininum=0 maximum=0xffffffff - tx_usecs_high: 0 # optional mininum=0 maximum=0xffffffff - tx_usecs_irq: 0 # optional mininum=0 maximum=0xffffffff - tx_usecs_low: 0 # optional mininum=0 maximum=0xffffffff + pkt_rate_high: 0 # optional minimum=0 maximum=0xffffffff + pkt_rate_low: 0 # optional minimum=0 maximum=0xffffffff + rx_frames: 0 # optional minimum=0 maximum=0xffffffff + rx_frames_high: 0 # optional minimum=0 maximum=0xffffffff + rx_frames_irq: 0 # optional minimum=0 maximum=0xffffffff + rx_frames_low: 0 # optional minimum=0 maximum=0xffffffff + rx_usecs: 0 # optional minimum=0 maximum=0xffffffff + rx_usecs_high: 0 # optional minimum=0 maximum=0xffffffff + rx_usecs_irq: 0 # optional minimum=0 maximum=0xffffffff + rx_usecs_low: 0 # optional minimum=0 maximum=0xffffffff + sample_interval: 0 # optional minimum=0 maximum=0xffffffff + stats_block_usecs: 0 # optional minimum=0 maximum=0xffffffff + tx_frames: 0 # optional minimum=0 maximum=0xffffffff + tx_frames_high: 0 # optional minimum=0 maximum=0xffffffff + tx_frames_irq: 0 # optional minimum=0 maximum=0xffffffff + tx_frames_low: 0 # optional minimum=0 maximum=0xffffffff + tx_usecs: 0 # optional minimum=0 maximum=0xffffffff + tx_usecs_high: 0 # optional minimum=0 maximum=0xffffffff + tx_usecs_irq: 0 # optional minimum=0 maximum=0xffffffff + tx_usecs_low: 0 # optional minimum=0 maximum=0xffffffff ring: - rx: 0 # optional mininum=0 maximum=0xffffffff - rx_jumbo: 0 # optional mininum=0 maximum=0xffffffff - rx_mini: 0 # optional mininum=0 maximum=0xffffffff - tx: 0 # optional mininum=0 maximum=0xffffffff + rx: 0 # optional minimum=0 maximum=0xffffffff + rx_jumbo: 0 # optional minimum=0 maximum=0xffffffff + rx_mini: 0 # optional minimum=0 maximum=0xffffffff + tx: 0 # optional minimum=0 maximum=0xffffffff ``` ### `ieee802_1x` @@ -959,7 +959,7 @@ following options: - `lacp_rate` - In `802.3ad` bonding mode, this option defines the rate in which we requst link + In `802.3ad` bonding mode, this option defines the rate in which we request link partner to transmit LACPDU packets. The possible values are: `slow`, `fast`. - `lp_interval` @@ -978,7 +978,7 @@ following options: - `num_grat_arp` - This option specify the number of peer notifications (gratuitious ARPs) to be + This option specify the number of peer notifications (gratuitous ARPs) to be issued after a failover event. The allowed range for the value is 0 - 255. - `packets_per_port` @@ -1464,7 +1464,7 @@ role treats like RHEL, such as AlmaLinux, CentOS, OracleLinux, Rocky. As Ansible usually works via the network, for example via SSH, there are some limitations to be considered: -The `network` role does not support bootstraping networking configuration. One option +The `network` role does not support bootstrapping networking configuration. One option may be [ansible-pull](https://docs.ansible.com/ansible/latest/cli/ansible-pull.html). Another option maybe be to initially auto-configure the host during installation (ISO diff --git a/library/network_connections.py b/library/network_connections.py index fec1fb04..fd0c56bb 100644 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -306,7 +306,7 @@ def ValueEscape(cls, value): return value if any(ord(c) < ord(" ") for c in value): - # needs ansic escaping due to ANSI control caracters (newline) + # needs ansic escaping due to ANSI control characters (newline) s = "$'" for c in value: if ord(c) < ord(c): @@ -2194,7 +2194,7 @@ def start_transaction(self): """Hook before making changes""" def finish_transaction(self): - """Hook for after all changes where made successfuly""" + """Hook for after all changes where made successfully""" def rollback_transaction(self, idx, action, error): """Hook if configuring a profile results in an error diff --git a/module_utils/network_lsr/argument_validator.py b/module_utils/network_lsr/argument_validator.py index cacfa0d6..aa80ff7a 100644 --- a/module_utils/network_lsr/argument_validator.py +++ b/module_utils/network_lsr/argument_validator.py @@ -2012,7 +2012,7 @@ def _validate_post_fields(self, value, name, result): # If there are no runtime changes, "wait" and "force_state_change" do # not make sense # FIXME: Maybe this restriction can be removed. Need to make sure that - # defaults for wait or force_state_change do not interfer + # defaults for wait or force_state_change do not interfere if not state: while "wait" in valid_fields: valid_fields.remove("wait") diff --git a/module_utils/network_lsr/nm/client.py b/module_utils/network_lsr/nm/client.py index 2327c76b..d1265a85 100644 --- a/module_utils/network_lsr/nm/client.py +++ b/module_utils/network_lsr/nm/client.py @@ -93,7 +93,7 @@ def _clean_up(self): self._mainloop = None def quit(self): - logging.debug("NM mainloop quiting") + logging.debug("NM mainloop quitting") self._mainloop.quit() self._clean_up() diff --git a/pylintrc b/pylintrc index 3cd37397..6f82dad5 100644 --- a/pylintrc +++ b/pylintrc @@ -52,7 +52,7 @@ confidence= # can either give multiple identifiers separated by comma (,) or put this # option multiple times (only on the command line, not in the configuration # file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if +# disable everything first and then re-enable specific checks. For example, if # you want to run only the similarities checker, you can use "--disable=all # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes diff --git a/scripts/print_all_options.py b/scripts/print_all_options.py index e0b31672..2fced631 100755 --- a/scripts/print_all_options.py +++ b/scripts/print_all_options.py @@ -84,7 +84,7 @@ def parse_validator(validator): if not validator.required: comment += " optional" if minval is not None: - comment += " mininum=" + str(minval) + comment += " minimum=" + str(minval) if maxval: if maxval == 0xFFFFFFFF: maxval = hex(maxval) diff --git a/tests/playbooks/tests_checkpoint_cleanup.yml b/tests/playbooks/tests_checkpoint_cleanup.yml index 48f59365..0fea2e08 100644 --- a/tests/playbooks/tests_checkpoint_cleanup.yml +++ b/tests/playbooks/tests_checkpoint_cleanup.yml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # This test is supposed to check that checkpoints are properly cleaned-up after # failures in the module. This test currently uses the initscripts provider to -# mark a device as unmanaged for NM and then tries to activiate it using NM. +# mark a device as unmanaged for NM and then tries to activate it using NM. # This failed without removing the checkpoint. --- - name: Play for testing checkpoint cleanup diff --git a/tests/tasks/manage_test_interface.yml b/tests/tasks/manage_test_interface.yml index c05ef824..fcf7f528 100644 --- a/tests/tasks/manage_test_interface.yml +++ b/tests/tasks/manage_test_interface.yml @@ -36,7 +36,7 @@ changed_when: false - name: Set up veth as managed by NetworkManager command: nmcli d set {{ interface }} managed true - # The varible for `network_provider` is not exists yet, + # The variable for `network_provider` is not exists yet, # just ignore error for initscripts ignore_errors: true # noqa ignore-errors when: "type == 'veth' and state == 'present'"