Skip to content

Commit ed8a06b

Browse files
committed
Move part of isort options 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. I tried multiple ways to use the src_path option, so we can just call isort without pointing out the target folders, but I was not successful. I tried running isort with "isort --settings-path=pyproject.toml" I got the error: "Error: arguments passed in without any paths or content." Additionally, I saw one project with source configuration https://github.com/Pylons/pyramid/blob/master/pyproject.toml, but they had to give explicit folders too https://github.com/Pylons/pyramid/blob/8061fce297cc7117d3e6e2b39e47512c7db2904f/tox.ini#L26 and https://github.com/Pylons/pyramid/blob/8061fce297cc7117d3e6e2b39e47512c7db2904f/tox.ini#L66 It was a similar situation with "check" and "diff". In the documentation it's said that for both check and diff are not supported in configuration files. See: - https://pycqa.github.io/isort/docs/configuration/options.html#check - https://pycqa.github.io/isort/docs/configuration/options.html#show-diff Additionally, in two issues it was confirmed that in integration tests we should use --check and --diff the way we did until now. As a result, I moved part of the configuration options for isort inside pyproject.toml without the actual directories that need to be linted and "check" and "diff" options. Signed-off-by: Martin Vrachev <[email protected]>
1 parent 4597761 commit ed8a06b

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

docs/CONTRIBUTORS.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,8 @@ CI/CD will check that new TUF code is formatted with `black
113113
Auto-formatting can be done on the command line:
114114
::
115115

116-
$ # TODO: configure black and isort args in pyproject.toml (see #1161)
117116
$ black <filename>
118-
$ isort --line-length 80 --profile black -p tuf tuf/api
117+
$ isort <filename>
119118

120119
or via source code editor plugin
121120
[`black <https://black.readthedocs.io/en/stable/editor_integration.html>`__,

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ build-backend = "setuptools.build_meta"
88
[tool.black]
99
line-length=80
1010

11+
# Isort section
12+
# Read more here: https://pycqa.github.io/isort/docs/configuration/config_files.html
13+
[tool.isort]
14+
profile="black"
15+
line_length=80
16+
known_first_party = ["tuf"]
17+
1118
# Pylint section
1219

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

tox.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ commands =
4040
changedir = {toxinidir}
4141
commands =
4242
# Use different configs for new (tuf/api/*) and legacy code
43-
# TODO: configure black and isort args in pyproject.toml (see #1161)
4443
black --check --diff tuf/api tuf/ngclient
45-
isort --check --diff --line-length 80 --profile black -p tuf tuf/api tuf/ngclient
44+
isort --check --diff tuf/api tuf/ngclient
4645
pylint -j 0 tuf/api tuf/ngclient --rcfile=pyproject.toml
4746

4847
# NOTE: Contrary to what the pylint docs suggest, ignoring full paths does

0 commit comments

Comments
 (0)