Run multiple python linters easily.
Install with pip:
pip install multilint
Run with:
multilint
I like to keep my projects tidy with a standard set of linters. Running them all turned out to be easier with a wrapper script, which I ended up copy-pasting between them all. This project stops me needing to copy/paste, centralizing running all these neat tools.
In order, it will check if these linters are installed, and if so, run them:
flake8
, to check code qualityisort
, in 'diff' mode to show where imports aren't sortedmodernize
, in 'diff' mode to show where python 2/3 compatibility withsix
is missingpython setup.py check
, to check yoursetup.py
is well configured. This will requiredocutils
, and alsoPygments
if yourlong_description
uses any code highlighting.
If any of them fail, multilint
stops and dies with a non-zero exit code.
Otherwise it succeeds!
You need to configure the paths that will be linted (by default, only
setup.py
is linted). Put a section in your setup.cfg
like:
[tool:multilint]
paths = my_package
tests
setup.py
I normally run my tests with tox
. An example tox.ini
to use
multilint
to do your linting on both Python 2.7 and 3.5 would look like:
[tox]
envlist =
py{27,35},
py{27,35}-codestyle
[testenv]
deps = -rrequirements.txt
commands = pytest
[testenv:py27-codestyle]
commands = multilint
[testenv:py35-codestyle]
commands = multilint
THen just put multilint
, plus the linters you want it to run (e.g.
flake8
) in your requirements.txt
.