logo

... pre-commit.


Pre-commit is a python package that helps prevent wrong code getting into a commit. It automates the checking such that small bugs are caught early. It can also be customised!


Notes

Keep in mind that the codespell hook is not a perfect spelling checking mechanism. It will merely look for common mistakes and it needs to be able to deal with code as well.

The config file now looks like this.

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v2.4.0
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: check-yaml
    -   id: check-added-large-files
    -   id: check-ast
    -   id: check-json
-   repo: https://gitlab.com/pycqa/flake8
    rev: 8f9b4931b9a28896fb43edccb23016a7540f5b82
    hooks:
    -   id: flake8
-   repo: https://github.com/codespell-project/codespell
    rev: v1.16.0
    hooks:
    -   id: codespell
        name: codespell
        description: Checks for common misspellings in text files.
        entry: codespell --ignore-words ignore-spelling-words.txt readme.md code.py
        language: python
        types: [text]

And this will be able to find spelling errors. Even the ones in your code!


Feedback? See an issue? Something unclear? Feel free to mention it here.

If you want to be kept up to date, consider getting the newsletter.