mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-23 09:18:49 +02:00
Merge pull request #21441 from netbox-community/21410-tighten-up-ruff-configuration-defaults
Fixes #21410: Expand Ruff exclusions and standardize formatting settings
This commit is contained in:
48
ruff.toml
48
ruff.toml
@@ -1,16 +1,58 @@
|
|||||||
|
# Ruff configuration
|
||||||
|
####################
|
||||||
|
|
||||||
exclude = [
|
exclude = [
|
||||||
"netbox/project-static/**"
|
".eggs",
|
||||||
|
".git",
|
||||||
|
".pyenv",
|
||||||
|
".pytest_cache",
|
||||||
|
".ruff_cache",
|
||||||
|
".venv",
|
||||||
|
".vscode",
|
||||||
|
"__pypackages__",
|
||||||
|
"_build",
|
||||||
|
"build",
|
||||||
|
"dist",
|
||||||
|
"netbox/project-static/**",
|
||||||
|
"node_modules",
|
||||||
|
"site-packages",
|
||||||
|
"venv",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Enforce line length and indent-width
|
||||||
line-length = 120
|
line-length = 120
|
||||||
|
indent-width = 4
|
||||||
|
|
||||||
|
# Ignores anything in .gitignore
|
||||||
|
respect-gitignore = true
|
||||||
|
|
||||||
|
# Always generate Python 3.12-compatible code
|
||||||
target-version = "py312"
|
target-version = "py312"
|
||||||
|
|
||||||
[lint]
|
[lint]
|
||||||
extend-select = ["E1", "E2", "E3", "E501", "W"]
|
extend-select = [
|
||||||
ignore = ["F403", "F405"]
|
"E1", # pycodestyle errors: indentation-related (e.g., unexpected/missing indent)
|
||||||
|
"E2", # pycodestyle errors: whitespace-related (e.g., missing whitespace, extra spaces)
|
||||||
|
"E3", # pycodestyle errors: blank lines / spacing around definitions
|
||||||
|
"E501", # pycodestyle: line too long (enforced with `line-length` above)
|
||||||
|
"W", # pycodestyle warnings (various style warnings, often whitespace/newlines)
|
||||||
|
]
|
||||||
|
ignore = [
|
||||||
|
"F403", # pyflakes: `from ... import *` used; unable to detect undefined names
|
||||||
|
"F405", # pyflakes: name may be undefined or defined from star imports
|
||||||
|
"UP032", # pyupgrade: prefer f-strings over `str.format(...)`
|
||||||
|
]
|
||||||
preview = true
|
preview = true
|
||||||
|
|
||||||
[lint.per-file-ignores]
|
[lint.per-file-ignores]
|
||||||
"template_code.py" = ["E501"]
|
"template_code.py" = ["E501"]
|
||||||
|
|
||||||
[format]
|
[format]
|
||||||
|
# Use single quotes for strings.
|
||||||
quote-style = "single"
|
quote-style = "single"
|
||||||
|
|
||||||
|
# Indent with spaces, rather than tabs.
|
||||||
|
indent-style = "space"
|
||||||
|
|
||||||
|
# Enforce UNIX line ending
|
||||||
|
line-ending = "lf"
|
||||||
|
|||||||
Reference in New Issue
Block a user