Skip to content

Conversation

@pkestene
Copy link
Collaborator

@pkestene pkestene commented Sep 7, 2025

Add pre-commit hooks config and fix reported typos

This PR adds configuration files for using pre-commit, e.g.

  • remove trailing white space,
  • end of file fixer,
  • spell checker (typos).

It can be run in command line terminal with pre-commit run --all-files (pre-commit is available either as a system package in Debian/Ubuntu or from a python package manager) . It could in principle be placed in a CI script, but it sometimes detects false positives (e.g. abbreviated variable names), so it is better to have a human eyes to cross-check.
False positives can be listed in _typos.toml so that they are ignored by the spell checker.

- pre-commit basic config: remove trailing white spaces, ...
- typos: try to fix spell check errors

typos there might report false-positive (e.g. a variable name). To exclude rightful names to be reported, just put them in `_typos.toml`, in section `default.extend-identifiers`.
Copy link
Collaborator

@tim-griesbach tim-griesbach left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! This looks good to me! The whitespace checking is a useful addition. I think it makes sense to unify the spellchecking since we have the script scspell calling codespell as well using doc/codespell_ignore.txt. One option would be to use codespell in the file .pre-commit-config.yaml instead of typos.
What do you think @cburstedde?

@pkestene
Copy link
Collaborator Author

Hi @tim-griesbach
I think both tools are useful and can be kept. typos was able to spot misspellings at some locations that had not been identified before. These are different tools with the same purpose; there is a comparative table there : https://github.com/crate-ci/typos/blob/master/docs/comparison.md

@cburstedde
Copy link
Owner

Thanks for the contribution and discussion, I think we can keep various tools around.
Wondering, what's a good place in the documentation to point at the current set of three: pre-commit, typos, codespell.
Would it make sense to add a paragraph that it is recommended to run some or all of them before submitting code?

@cburstedde
Copy link
Owner

Comparing with the analogous PR in p4est, would it be possible to shorten the exclude list in this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants