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 test contributed here materials against typos, and fix some typos #103

Merged
merged 4 commits into from
Feb 14, 2024

Conversation

yarikoptic
Copy link
Contributor

Description

Fix and prevent future common typos using https://github.com/codespell-project/codespell

Let me know if you want to add support for codespell into the template

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?

Typos are there and more might sneak in

What does this PR do?

adds pre-commit and github workflow (let me know if I should remove) and fixes some typos

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
@adamltyson
Copy link
Member

@neuroinformatics-unit/neuroinformatics-all this looks nice, shall we add it to the cookiecutter template itself (and by extension, other repos)?

@niksirbi
Copy link
Member

I'm in favour of it. We are already using it on some of our other repos anyway.

@alessandrofelder
Copy link
Member

Happy with it too.

@sfmig
Copy link
Contributor

sfmig commented Feb 13, 2024

Just FYI: ARC colleagues recommend their usage but agreed not to add it to their cookiecutter template, due to false positives and it sometimes breaking their code. I have no experience using it as a pre-commit though.

@yarikoptic
Copy link
Contributor Author

FWIW it is always a good practice to review pre-commit's changes. But indeed in case of a "heavy" pre-commit changes (black etc) it might be tricky... but in this case it doesn't even apply

since codespell pre-commit hook by default is just a checker, not a writer (need to pass `-w` option to make that happen)
echo Installating >> README.md
changes on filesystem:                                                                              
 README.md | 1 +
❯ git commit -m 'Adding a typo' -a
check docstring is first.............................(no files to check)Skipped
check that executables have shebangs.................(no files to check)Skipped
check for merge conflicts................................................Passed
fix end of files.........................................................Passed
mixed line ending........................................................Passed
fix requirements.txt.................................(no files to check)Skipped
trim trailing whitespace.................................................Passed
ruff.................................................(no files to check)Skipped
black................................................(no files to check)Skipped
codespell................................................................Failed
- hook id: codespell
- exit code: 65

README.md:308: Installating ==> Installing

❯ git commit -m 'Adding a typo' -a
check docstring is first.............................(no files to check)Skipped
check that executables have shebangs.................(no files to check)Skipped
check for merge conflicts................................................Passed
fix end of files.........................................................Passed
mixed line ending........................................................Passed
fix requirements.txt.................................(no files to check)Skipped
trim trailing whitespace.................................................Passed
ruff.................................................(no files to check)Skipped
black................................................(no files to check)Skipped
codespell................................................................Failed
- hook id: codespell
- exit code: 65

README.md:308: Installating ==> Installing

so the worst effect from false-positive - inability to commit until white-listing that particular hit one way or another.

@adamltyson
Copy link
Member

Thanks @yarikoptic. I'll raise a seperate PR to make it part of the template itself.

@adamltyson adamltyson merged commit 419fa79 into neuroinformatics-unit:main Feb 14, 2024
8 checks passed
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.

5 participants