Skip to content

Commit 2442cff

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 0519791 commit 2442cff

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-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 tuf/api tuf/ngclient
118-
$ isort --line-length 80 --profile black -p tuf tuf/api
117+
$ isort tuf/api tuf/ngclient
119118

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

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ line-length=80
99
check="True"
1010
diff="True"
1111

12+
# Isort section
13+
[tool.isort]
14+
profile="black"
15+
line_length=80
16+
known_first_party = ["tuf"]
17+
1218
# Pylint section
1319

1420
# 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 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)