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 to pre-commit checks #1717

Merged
merged 1 commit into from Jan 22, 2022

Conversation

aphedges
Copy link
Contributor

Back in October 2021, I created #1423 to fix a large number of spelling errors. I've noticed some spelling errors in commits since then, but doing what I did on my first pass is way too time-intensive to do regularly. However, I found out about codespell, which is used in some other open source projects. Instead of being a strict check against a dictionary, it uses rules to fix common mistakes. While it likely does not catch every error that a more complete spellcheck would, it produces much fewer false positives. Running it on the repository (which takes under a second) catches some errors I missed back in my previous pass, as well as some spelling errors that were added more recently. Adding it to the checks will make spelling errors more difficult to sneak in.

I put the configuration directly into .pre-commit-config.yaml for ease of development, but I notice that clang-format and yapf both have separate config files. codespell supports both setup.cfg and .codespellrc files for configuration. Should I put it in one of them instead? If so, any preference for one file over the other?

I explicitly excluded three files that have been automatically generated and not meant for human consumption anyway. In addition, I explicitly excluded the word unsupport from the check because it is used in 12 poorly worded error messages that can probably have their wording improved to be more grammatical. I don't think that change is important enough to make it into this PR, though.

@jeffra
Copy link
Contributor

jeffra commented Jan 22, 2022

Thank you @aphedges, this is super cool!

@jeffra jeffra merged commit 4cf970e into microsoft:master Jan 22, 2022
5 checks passed
B06901052 pushed a commit to B06901052/DeepSpeed that referenced this pull request Apr 14, 2022
B06901052 pushed a commit to B06901052/DeepSpeed that referenced this pull request Apr 14, 2022
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