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 #26315

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

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.

  • There were numerous commits where codespell was used "manually" to fixup some of the typos.

  • CI: use codespell, flake8 to check code before merging? #13694 still contemplates idea of running codespell on PRs

  • An early attempt to introduce codespell CI was abandoned: BLD: Codespell for NumPy CI #19594 -- IMHO now is better time!

  • I did lapack_lite last in the separate commits if there is desire to not touch it (although I saw commits fixing typos in it as well).

  • I did some variable renames to take them away from "close to a typo" form, might be worth having a look and suggesting alternative names.

  • I did fix older changelogs as I think there is no point to cherish typos in them, but they could also be ignored.

@charris
Copy link
Member

charris commented Apr 19, 2024

Please don't touch the changelogs, they match the title used in the corresponding PR, typos and all.

@@ -262,7 +262,7 @@ conflict of interests include, but are not limited to:
All members of the Council shall disclose to the rest of the Council any
conflict of interest they may have. Members with a conflict of interest
in a particular issue may participate in Council discussions on that
issue, but must recuse themselves from voting on the issue.
issue, but must recurse themselves from voting on the issue.
Copy link
Member

Choose a reason for hiding this comment

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

not a big fan of a adding automated spell-checking if we'll have to ignore it making mistakes like this...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rright -- I even ran into this particular one before -- recuse is indeed rare and I failed to spot it in review, sorry about that. I will whitelist it.

@yarikoptic
Copy link
Contributor Author

Thanks for quick feedback @charris and @ngoldbaum !

I

  • rebased (apparently there were new typos in main)
  • ran with current master of codespell to ensure picking up as many typos as possible (thought that typos detected by CI were due to mine being outdated but it just needed rebase)
  • whitelisted some more per feedback above (do not touch changelogs, recuse is ok so we might recuse into folders at some point as a side-effect ;-) )
  • adjusted some patches to make lint satisfied (one change with spaces around = was for "old" code, but triggered to be checked since I changed the line)

=== 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 ^^^
… automagically but ignoring the failure due to ambigous typos

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w || :",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
…us typos

=== 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 ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
Funny thing is that it does not catch it on 'main' for some reason
but catches here... it is likely because

  python tools/linter.py --branch origin/main

works on the diff only (too fast on main) and thus whenever those
spaces were introduced, it did not check and never flipped since then.
I changed that line, and it was checked and flagged.
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.

None yet

3 participants