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

codespell: config, github action (to detect new typos), and 2 typos fixed #65

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
run: tox -e pyroma
- name: Check static typing with MyPy
run: tox -e mypy
- name: Check for typos with codespell
run: tox -e codespell
docs:
name: Documentation
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ profile = "black"
multi_line_output = 3
include_trailing_comma = true
reverse_relative = true

[tool.codespell]
skip = '.git,*.pdf,*.svg'
#
# ignore-words-list = ''
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# ignore-words-list = ''
# ignore-words-list = ''
ignore-regex = "\bassertIn\b"

For case sensitive matching IIRC (adding whole on mobile)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just wondering if this will always be something I have to chase. How does it deal with function names, which might be out of my control if they don't match?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is such a common fear ;) in the projects using CamelCase or some other mixedCase, I just add regex to catch those, smth like (pick your poison)

❯ grep ignore-regex.*A-Z */.codespellrc
alphafold/.codespellrc:ignore-regex = (^\s*"image/\S+": ".*|\b[A-Z]+\b)
citation-file-format/.codespellrc:ignore-regex = ["`][A-Z][A-Z]["`]
gdcm-gdcm/.codespellrc:ignore-regex = \b([A-Z]+|[A-Z][a-z]*)\b
hpc-toolkit/.codespellrc:ignore-regex = HETATM -e CONECT|\([A-Z]\)[a-z]+
hugo/.codespellrc:ignore-regex = .*TE\?MP.*|.*codespell-ignore.*|[A-Z]?[a-z]*[A-Z][a-zA-Z]*|/extras/crossreferences/|Januar 2023|\\ndoes|.*ä.*
lazydocker/.codespellrc:ignore-regex = (\b[A-Za-z][a-z]*[A-Z]\S+\b|\.edn\b|\S+…|\\nd\b)
lazygit/.codespellrc:ignore-regex = (\b[A-Za-z][a-z]*[A-Z]\S+\b|\.edn\b|\S+…|\\nd\b)
NeuroML-Documentation/.codespellrc:ignore-regex = ^\s*"image/\S+": ".*|\b[a-z]*[A-Z][a-zA-Z]*\b
qlever/.codespellrc:ignore-regex = \b([A-Z]*[a-z]+[A-Z][a-zA-Z]*)\b|.*(Lorem ipsum|eleifend|feugait|codespell-ignore).*
quarto/.codespellrc:ignore-regex = \b[a-z]+[A-Z][A-Za-z]*\b
remark/.codespellrc:ignore-regex = \b(Hart|[A-Z]+)\b|.{300,}.*
saunafs/.codespellrc:ignore-regex = \b[A-Z]*[a-z]+[A-Z][A-Za-z]*\b|/mnt/[a-z0-9]+|.*\bcodespell-ignore\b.*
scidata/.codespellrc:ignore-regex = .*[úáüéè].*|\b[A-Z]+\b|\bvalue=".."
webknossos/.codespellrc:ignore-regex = \b(Manuel|[a-z]+[A-Z][a-zA-Z]*|H Mattern|Nat Commun|couldn't)\b

but as you can see here it was just a single hit, so I personally would not sweat for now. ;-) generally it is better to avoid names (variables, arguments, or functions alike) coming close to typos.

7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ allowlist_externals =
/usr/bin/cat
/usr/bin/mkdir

[testenv:codespell]
description = Check for typos
deps =
codespell[toml]
commands =
codespell

[testenv:coverage-report]
deps = coverage
skip_install = true
Expand Down
Loading