backend/ruff.toml
Rama master · réplica de lectura del repositorio original.
# Ruff configuration for Sublarr Backend
# Ruff is a fast Python linter and formatter
line-length = 100
target-version = "py311"
# Vendored third-party code — we do not lint or reformat it because patches
# must stay minimal to keep the ledger (providers/_vendor/VENDOR_PATCHES.md)
# honest and upstream updates easy to apply.
# providers/hub/bundles is copied verbatim from the Bazarr+ provider catalog
# and hash-checked at load time — reformatting it would break the hashes.
extend-exclude = ["providers/_vendor", "providers/hub/bundles"]
[lint]
# Select rule sets: E (pycodestyle errors), F (pyflakes), I (isort), N (pep8-naming), W (pycodestyle warnings)
# SIM = Simplify (code simplification), BLE = Blind Except (exception handling)
select = ["E", "F", "I", "N", "W", "UP", "SIM", "BLE"] # UP = pyupgrade
ignore = [
"E501", # Line too long (handled by formatter)
"W191", # Indentation contains tabs (we use spaces)
"SIM108", # Use ternary operator (can reduce readability)
"SIM102", # Nested if → single if (readability preference)
"SIM105", # contextlib.suppress (explicit try/except is clearer)
"BLE001", # Blind except (we handle specific exceptions where needed)
"E741", # Ambiguous variable name `l` (used for line in subtitle loops)
"N806", # Uppercase variable in function (module-level constants in functions)
"N817", # CamelCase imported as acronym (e.g. TPE for ThreadPoolExecutor)
"SIM115", # Use context manager for file open (explicit try/except preferred)
"E402", # Module level import not at top (intentional lazy/conditional imports)
"UP035", # typing.Dict/List deprecated (gradual migration)
]
[lint.isort]
known-first-party = ["providers", "config", "database", "server"]
[lint.per-file-ignores]
# Ignore specific rules for test files
"tests/**/*.py" = ["E501", "F401", "E402", "F823"] # Allow long lines, unused imports, late imports, pre-assign refs in tests
"routes/tracks.py" = ["E701", "E702"] # Intentional one-liners for compact stream parsing
[format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"