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

Add codespell support (config, workflow to detect/not fix) and make it fix few typos #27

Merged
merged 5 commits into from
Feb 19, 2025

Conversation

yarikoptic
Copy link
Contributor

More about codespell: https://github.com/codespell-project/codespell .

I personally introduced it to dozens if not hundreds of projects already and so far only positive feedback.

CI workflow has 'permissions' set only to 'read' so also should be safe.

…(but ignoring overall fail due to ambigous ones)

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w || :",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w -i 3 -C 2",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.17%. Comparing base (bd85b3a) to head (0e00255).
Report is 12 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #27      +/-   ##
==========================================
- Coverage   78.84%   76.17%   -2.68%     
==========================================
  Files           2        2              
  Lines        1026     1024       -2     
==========================================
- Hits          809      780      -29     
- Misses        217      244      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Spotted while running tests... apparently there is a known issue and
words near single quotes are not detected since that quote could be
a part of the word: codespell-project/codespell#3305
@deajan deajan merged commit a69e610 into netinvent:master Feb 19, 2025
26 of 37 checks passed
@deajan
Copy link
Contributor

deajan commented Feb 19, 2025

Really like this one ^^
Thank you !

@deajan
Copy link
Contributor

deajan commented Feb 19, 2025

Just used this on another repo, works like a charm.
Just a quick side question, how do you get the excludes to work ?
I'd usually just add this to my testing workflow on top of black / pylint / flake8, so I'd run this with --skip *.yaml or so. How yo I achieve the same with gh actions ?

@yarikoptic
Copy link
Contributor Author

action is just a wrapper around the codespell tool -- thus best to avoid any generic configuration in the action. For that there is the .codespellrc file https://github.com/netinvent/command_runner/pull/27/files#diff-5df60be1ec15d5da885121f5941ad7ceb4a31d7edeaf038873247cd1b9eb0193 where you could add "global" skips of words or regexes. There is also ways for "inline" ignores using codespell:ignore in the line comments https://github.com/codespell-project/codespell?tab=readme-ov-file#inline-ignore .

FWIW -- if you eventually add pyproject.toml or setup.cfg - you can move configuration into that file. see https://github.com/codespell-project/codespell?tab=readme-ov-file#using-a-config-file for more info

@yarikoptic
Copy link
Contributor Author

FWIW if you are using black, can also start using pre-commit and then add codespell there too... See e.g. our https://github.com/dandi/dandi-cli/blob/master/.pre-commit-config.yaml

For adding to other projects, consider (generalizing or adopting) my crude helper: https://github.com/yarikoptic/improveit/blob/main/codespellit

@deajan
Copy link
Contributor

deajan commented Feb 20, 2025

Thank you for the insight. Adopted codespell.

@yarikoptic yarikoptic deleted the enh-codespell branch February 20, 2025 18:43
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