Skip to content

Commit 0519791

Browse files
committed
Move black configuration in pyproject.toml
We are using 4 linters: black, isort, pylint and mypy. It's good if we use one file as a source for truth for all linter configurations. As a first step move black options in pyproject.toml. I tried multiple ways to use the include option, so we can just call black --config=pyproject.toml, but I was not successful. Then I found this comment psf/black#861 (comment) explaining that the path argument is mandatory. As a result, I will move all configuration options for black inside pyproject.toml without the actual directories that need to be linted. Signed-off-by: Martin Vrachev <[email protected]>
1 parent d134b7a commit 0519791

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

docs/CONTRIBUTORS.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Auto-formatting can be done on the command line:
114114
::
115115

116116
$ # TODO: configure black and isort args in pyproject.toml (see #1161)
117-
$ black --line-length 80 tuf/api
117+
$ black tuf/api tuf/ngclient
118118
$ isort --line-length 80 --profile black -p tuf tuf/api
119119

120120
or via source code editor plugin

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
# Build-system section
12
[build-system]
23
requires = ["setuptools>=40.8.0", "wheel"]
34
build-backend = "setuptools.build_meta"
45

6+
# Black section
7+
[tool.black]
8+
line-length=80
9+
check="True"
10+
diff="True"
11+
512
# Pylint section
613

714
# Minimal pylint configuration file for Secure Systems Lab Python Style Guide:

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ changedir = {toxinidir}
4141
commands =
4242
# Use different configs for new (tuf/api/*) and legacy code
4343
# TODO: configure black and isort args in pyproject.toml (see #1161)
44-
black --check --diff --line-length 80 tuf/api tuf/ngclient
44+
black tuf/api tuf/ngclient
4545
isort --check --diff --line-length 80 --profile black -p tuf tuf/api tuf/ngclient
4646
pylint -j 0 tuf/api tuf/ngclient --rcfile=pyproject.toml
4747

0 commit comments

Comments
 (0)