Linters
we should use several linters to make the coding style consistent. All configuration is stored inside setup.cfg
black
flake8 is used a general tool for linting
isort is used to validate
importorderbandit for static security checks
Pre-Commit hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
- id: blackFlake8
flake8 plugins
flake8-pytest - ensures that
pytestbest practices are usedflake8-pytest-style - ensures that
pytesttests and fixtures are written in a single styleflake8-django - plugin to enforce best practices in a
djangoproject
MyPy
Mypy is an optional static type checker for Python that aims to combine the benefits of dynamic (or "duck") typing and static typing.
Installation and usage.
And run it.
Examples
Pre-Commit Hooks
Last updated
Was this helpful?