Code quality checks#
Running single test file
To run single test file with pytest
flake8#
Flake8 is a wrapper around these tools:
- PyFlakes which checks Python source files for errors.
- pycodestyle, a tool to check your Python code against some of the style conventions in PEP 8.
- Ned Batchelder’s McCabe script for checking McCabe complexity.
See list of awesome flake8 plugins
List of included 3rd-party plugins:
- flake8-alfred - warn on unsafe/obsolete symbols.
- flake8-alphabetize - checker for alphabetizing import and all.
- flake8-broken-line - forbid backslashes for line breaks.
- flake8-bugbear - finding likely bugs and design problems in your program.
- flake8-builtins - check for python builtins being used as variables or parameters.
- flake8-comprehensions - check for invalid list/set/dict comprehensions.
- flake8-docstrings - uses pydocstyle to check docstrings
- flake8-eradicate - find commented out (or so called "dead") code.
- flake8-functions - report on issues with functions.
- flake8-functions-names - validates function names, decomposition and conformity with annotations. Conventions from here and here.
- flake8-printf-formatting - forbids printf-style string formatting
- flake8-pytest-style - checking common style issues or inconsistencies with pytest-based tests.
- flake8-simplify - helps you simplify your code.
- pep8-naming - check your code against PEP 8 naming conventions.
- flake8-expression-complexity - validates expression complexity and stops you from creating monstrous multi-line expressions.
- flake8-cognitive-complexity - validates cognitive functions complexity.
pre-commit#
A framework for managing and maintaining multi-language pre-commit hooks.
Git hook scripts are useful for identifying simple issues before submission to code review. We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements. By pointing these issues out before code review, this allows a code reviewer to focus on the architecture of a change while not wasting time with trivial style nitpicks.
List of hooks#
Last update:
July 3, 2022
Created: July 3, 2022
Created: July 3, 2022