Add a code linting tool chain
- use flake8 as the main and pylint as the auxiliary linter
- install flake8 with the following plug-ins:
+ flake8-annotations => enforce type annotations for functions/classes
+ flake8-black => ensure black would not make any changes
+ flake8-expression-complexity
+ wemake-python-styleguide, which packages the following:
* darglint * flake8-bandit * flake8-broken-line
* flake8-bugbear * flake8-commas * flake8-comprehensions
* flake8-debugger * flake8-docstrings * flake8-eradicate
* flake8-isort * flake8-rst-docstrings * flake8-string-format
* flake8-quotes * pep8-naming
- configure flake8 & friends in a rather explicit and strict way
- isort needed to be downgraded to ^4.3.21 due to a conflict with
pylint and wemake-python-styleguide:
+ provide TODO's to remove the parts that "fix" isort
- use mypy for static type checking
- add a nox session "lint" that runs flake8, mypy, and pylint
- lint all source files
This commit is contained in:
parent
bb6de05709
commit
c7989e0040
4 changed files with 938 additions and 24 deletions
|
|
@ -4,7 +4,7 @@ requires = ["poetry>=0.12"]
|
|||
|
||||
[tool.black]
|
||||
line-length = 88
|
||||
skip-string-normalization = true
|
||||
skip-string-normalization = true # wemake-python-styleguide enforces single quotes
|
||||
target-version = ["py38"]
|
||||
|
||||
[tool.poetry]
|
||||
|
|
@ -34,4 +34,13 @@ nox = "^2020.5.24"
|
|||
# Code Formatters
|
||||
autoflake = "^1.3.1"
|
||||
black = "^19.10b0"
|
||||
isort = "^5.2.2"
|
||||
isort = "^4.3.21" # TODO (isort): not ^5.2.2 due to pylint and wemake-python-styleguide
|
||||
|
||||
# (Static) Code Analyzers
|
||||
flake8 = "^3.8.3"
|
||||
flake8-annotations = "^2.3.0"
|
||||
flake8-black = "^0.2.1"
|
||||
flake8-expression-complexity = "^0.0.8"
|
||||
mypy = "^0.782"
|
||||
pylint = "^2.5.3"
|
||||
wemake-python-styleguide = "^0.14.1" # flake8 plug-in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue