mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
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 too8061fce297/tox.ini (L26)and8061fce297/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 <mvrachev@vmware.com>
90 lines
3.1 KiB
TOML
90 lines
3.1 KiB
TOML
# Build-system section
|
|
[build-system]
|
|
requires = ["setuptools>=40.8.0", "wheel"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
# Black section
|
|
# Read more here: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#configuration-via-a-file
|
|
[tool.black]
|
|
line-length=80
|
|
|
|
# Isort section
|
|
# Read more here: https://pycqa.github.io/isort/docs/configuration/config_files.html
|
|
[tool.isort]
|
|
profile="black"
|
|
line_length=80
|
|
known_first_party = ["tuf"]
|
|
|
|
# Pylint section
|
|
|
|
# Minimal pylint configuration file for Secure Systems Lab Python Style Guide:
|
|
# https://github.com/secure-systems-lab/code-style-guidelines
|
|
#
|
|
# Based on Google Python Style Guide pylintrc and pylint defaults:
|
|
# https://google.github.io/styleguide/pylintrc
|
|
# http://pylint.pycqa.org/en/latest/technical_reference/features.html
|
|
|
|
[tool.pylint.message_control]
|
|
# Disable the message, report, category or checker with the given id(s).
|
|
# NOTE: To keep this config as short as possible we only disable checks that
|
|
# are currently in conflict with our code. If new code displeases the linter
|
|
# (for good reasons) consider updating this config file, or disable checks with.
|
|
disable=[
|
|
"fixme",
|
|
"too-few-public-methods",
|
|
"too-many-arguments",
|
|
"format",
|
|
"duplicate-code"
|
|
]
|
|
|
|
[tool.pylint.basic]
|
|
good-names = ["i","j","k","v","e","f","fn","fp","_type","_"]
|
|
# Regexes for allowed names are copied from the Google pylintrc
|
|
# NOTE: Pylint captures regex name groups such as 'snake_case' or 'camel_case'.
|
|
# If there are multiple groups it enfoces the prevalent naming style inside
|
|
# each modules. Names in the exempt capturing group are ignored.
|
|
function-rgx="^(?:(?P<exempt>setUp|tearDown|setUpModule|tearDownModule)|(?P<camel_case>_?[A-Z][a-zA-Z0-9]*)|(?P<snake_case>_?[a-z][a-z0-9_]*))$"
|
|
method-rgx="(?x)^(?:(?P<exempt>_[a-z0-9_]+__|runTest|setUp|tearDown|setUpTestCase|tearDownTestCase|setupSelf|tearDownClass|setUpClass|(test|assert)_*[A-Z0-9][a-zA-Z0-9_]*|next)|(?P<camel_case>_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P<snake_case>_{0,2}[a-z][a-z0-9_]*))$"
|
|
argument-rgx="^[a-z][a-z0-9_]*$"
|
|
attr-rgx="^_{0,2}[a-z][a-z0-9_]*$"
|
|
class-attribute-rgx="^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$"
|
|
class-rgx="^_?[A-Z][a-zA-Z0-9]*$"
|
|
const-rgx="^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$"
|
|
inlinevar-rgx="^[a-z][a-z0-9_]*$"
|
|
module-rgx="^(_?[a-z][a-z0-9_]*|__init__)$"
|
|
no-docstring-rgx="(__.*__|main|test.*|.*test|.*Test)$"
|
|
variable-rgx="^[a-z][a-z0-9_]*$"
|
|
docstring-min-length=10
|
|
|
|
[tool.pylint.logging]
|
|
logging-format-style="old"
|
|
|
|
[tool.pylint.miscellaneous]
|
|
notes="TODO"
|
|
|
|
[tool.pylint.STRING]
|
|
check-quote-consistency="yes"
|
|
|
|
# mypy section
|
|
# Read more here: https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml-file
|
|
[tool.mypy]
|
|
warn_unused_configs = "True"
|
|
warn_redundant_casts = "True"
|
|
warn_unused_ignores = "True"
|
|
warn_unreachable = "True"
|
|
strict_equality = "True"
|
|
disallow_untyped_defs = "True"
|
|
disallow_untyped_calls = "True"
|
|
show_error_codes = "True"
|
|
files = [
|
|
"tuf/api/",
|
|
"tuf/ngclient",
|
|
"tuf/exceptions.py"
|
|
]
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = [
|
|
"securesystemslib.*",
|
|
"urllib3.*"
|
|
]
|
|
ignore_missing_imports = "True"
|