Calmcode - test: pre-commit


1 2 3 4 5 6 7 8 9

We've got videos on black, flake8 and pre-commit hooks if you're unfamiliar. That said, let's install these dependencies.

python -m pip install pre-commit flake8 black

The following is the final .pre-commit-config.yaml that we ended up with:

# See for more information
# See for more hooks
-   repo:
    rev: v2.4.0
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: check-yaml
    -   id: check-added-large-files
-   repo:
    rev: 8f9b4931b9a28896fb43edccb23016a7540f5b82
    -   id: flake8
-   repo:
    rev: stable
      - id: black
        language_version: python3.7

The only thing left is to run:

pre-commit install

And by running this command we'll now automatically check our code on every commit.