Commit 2d9f7dd2 authored by Simon Chabot's avatar Simon Chabot
Browse files

[tox] Add black formatting check

parent 120cde42a913
[hooks]
precommit.black = tox -e black-run
pre-amend.black = tox -e black-run
......@@ -21,6 +21,18 @@ Documentation
The documentation is available at https://yams.readthedocs.io/
Code style
----------
The python code is verified against *flake8* and formatted with *black*.
* You can run `tox -e black` to check that the files are well formatted.
* You can run `tox -e black-run` to format them if needed.
* You can include the `.hgrc` to your own `.hgrc` to automatically run black
before each commit/amend. This can be done by writing `%include ../.hgrc` at
the end of your `.hgrc`.
Comments, support, bug reports
------------------------------
See the tracker at https://www.logilab.org/project/yams
[tool.black]
line-length = 100
target-version = ['py37']
exclude = '''(
\(
dist
| docs
| \.tox
| \.hg
| \.mypy_cache
| \.pytest_cache
| __pycache__
| yams.egg-info
\)
)'''
[tox]
envlist=py3,check-manifest,flake8,mypy
envlist=py3,check-manifest,flake8,mypy,black,black-run
[testenv]
basepython=python3
......@@ -14,6 +14,20 @@ deps =
commands =
{envpython} -m check_manifest {toxinidir}
[testenv:black]
basepython = python3
skip_install = true
deps =
black >= 19.10b0
commands = black --check .
[testenv:black-run]
basepython = python3
skip_install = true
deps =
black >= 19.10b0
commands = black .
[testenv:flake8]
skip_install = true
deps =
......@@ -22,7 +36,7 @@ commands = flake8
[flake8]
format = pylint
ignore = W503
ignore = W503, E203, E731, E231
max-line-length = 100
exclude = docs/*,.tox/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment