Files
neutron/pyproject.toml
Stephen Finucane be77ed3a81 pre-commit: Migrate to ruff, enable autopep8
This allows us to replace bandit and flake8. It also ensures we run
pyupgrade-like checks continuously to prevent adding Python < 3.10 style
syntax in the future.

Long-term, we should look at replacing autopep8 with ruff, but that's a
different discussion :)

Change-Id: I12f058d95a0745d895b3257dbaa4e866835c7008
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-07-01 10:47:55 +01:00

44 lines
1.5 KiB
TOML

[build-system]
requires = ["pbr>=6.0.0", "setuptools>=64.0.0"]
build-backend = "pbr.build"
[tool.mypy]
incremental = true
pretty = true
show_error_context = true
show_column_numbers = true
warn_unused_ignores = true
# remove gradually as progress is made
disable_error_code = "import-untyped,var-annotated,import-not-found"
# honor excludes by not following there through imports
follow_imports = "silent"
files = "neutron"
# NOTE: Gradually enable type checking for each package.
# Finally, when the whole repo is migrated this option can be deleted
# and rules applied to the whole repo.
exclude = "(?x)(^neutron/tests/$)"
[tool.ruff]
line-length = 79
target-version = "py310"
[tool.ruff.lint]
select = ["E4", "E7", "E9", "F", "S", "U"]
ignore = [
"E731", # Do not assign a `lambda` expression, use a `def`
"E741", # Ambiguous variable name: `l`
"S104", # Possible binding to all interfaces
"UP031", # Use format specifiers instead of percent format
"UP032", # Use f-string instead of `format` call
# FIXME(stephenfin): These can all be auto-fixed by ruff and
# should be enabled
"UP018", # Unnecessary `int` call (rewrite as a literal)
"UP024", # Replace aliased errors with `OSError`
"UP030", # Use implicit references for positional format fields
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
"UP039", # Unnecessary parentheses after class definition
]
[tool.ruff.lint.per-file-ignores]
"neutron/tests/*" = ["S"]