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 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
- repo: https://gitlab.com/pycqa/flake8
rev: 8f9b4931b9a28896fb43edccb23016a7540f5b82
hooks:
- id: flake8
- repo: https://github.com/psf/black
rev: stable
hooks:
- 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.