Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Check spelling with codespell #83

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

spetrosi
Copy link
Contributor

@spetrosi spetrosi commented Feb 6, 2025

  • 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.

@spetrosi
Copy link
Contributor Author

spetrosi commented Feb 6, 2025

@richm how does it look like? Here is the new workflow in action: linux-system-roles/timesync#267

I implemented a workaround for finding not-inclusive words as substring - reporting "master" in "timemaster" by using codespell's --regex argument, it allows to tell codespell what regex use to find words that it then compares literally to wrods in a dictionary. With this argument I provide a regex listing all the prohibited words with OR. See https://github.com/linux-system-roles/.github/pull/83/files#diff-72f9ba5d2a38c1ef7cbff07f2730afebeb30869bcb0c860b28c1b57e30a4feb2R20 and https://github.com/linux-system-roles/timesync/actions/runs/13180437334/job/36789627576?pr=267#step:6:21
Not a very clean workaround tbh, but codespell doesn't support adding words to dictionary as regex. The workaround is to

Codespell community is active, I have a PR for the action in review codespell-project/actions-codespell#86. So far, I am running the action from my fork.

Codespell has some nice features like the ability to ignore per-line, ignore files and dirs, disable and enable checking within files. Comparing it to woke, codespell doesn't provide different levels of report like warning and error, any match is reported as an error.
It has a built-in dictionary in https://github.com/codespell-project/codespell/blob/main/codespell_lib/data/dictionary_usage.txt, however we can use write our own dictionary too.

I honestly don't remember what else we didn't like about woke.

@richm
Copy link
Contributor

richm commented Feb 6, 2025

One minor nit, otherwise, lgtm

@spetrosi spetrosi force-pushed the codespell-init branch 2 times, most recently from 056a77d to d3d2829 Compare February 12, 2025 09:24
@spetrosi spetrosi changed the title Replace woke with codespell ci: Check spelling with codespell Feb 12, 2025
* 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.
@spetrosi spetrosi merged commit 95e067d into linux-system-roles:main Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants