QUA-002, seconde moitie. Le depot etant formate, l elargissement porte sur
des defauts et non sur du brassage.
Ajoute a la selection : B (bugbear), C4, RET, SIM, UP. Le lot entier n a
produit que 24 signalements sur 76 fichiers -- le code etait plus propre
que l audit ne le craignait. Neuf corriges automatiquement, quinze a la
main.
SIM108 est ignore : forcer un ternaire se lit moins bien que le if/else
qu il remplace, au seul endroit ou il se declenche.
isort (I) n est PAS active. Il reordonnerait les imports de 48 fichiers,
soit une seconde passe de pur brassage juste apres le commit de formatage.
A faire, mais seul.
Deux vrais defauts trouves par les nouvelles regles
- team_matches.edit_match faisait `except ValueError: pass` sur l heure de
debut et l heure de fin, trois lignes sous un champ date qui, lui,
signale et redirige. Une heure mal saisie etait donc acceptee par le
formulaire, jetee, l ancienne valeur conservee -- et la page annoncait
la reussite. Meme traitement que la date desormais.
- backup.py levait BackupError depuis deux blocs `except` sans `from`,
ce qui perdait la cause d origine dans la trace.
Ainsi que : un `return` explicite dans force_https, `%`-formatage remplace
dans log_auth_event (operations de chaine avant journalisation, pas des
gabarits de logger -- la redaction n est pas affectee), une compréhension
inutile, un `set(...)` en compréhension d ensemble, `open(..., 'r')`, une
variable de boucle inutilisee, et `contextlib.suppress` dans conftest.
CI : `ruff format --check` remplace le commentaire qui expliquait pourquoi
il etait absent.
263 tests passent. Les deux nouveaux messages sont traduits ; attention,
pybabel les avait apparies en `fuzzy` avec des entrees « date » existantes,
et une entree fuzzy est ignoree a l execution.
Co-Authored-By: Claude Opus 5 <[email protected]>
65 lines
2.7 KiB
TOML
65 lines
2.7 KiB
TOML
# Tooling configuration.
|
|
#
|
|
# Deliberately limited to tool settings: the project is run from wsgi.py,
|
|
# not installed as a distribution, so there is no [project] table.
|
|
#
|
|
# QUA-001 asked for requirements.txt / requirements-dev.txt to be folded
|
|
# into dependency groups here. Not done, on purpose. Deployment is an
|
|
# lftp file mirror with no build step: the server runs whatever
|
|
# `pip install -r requirements.txt` gives it, and PEP 735 groups need
|
|
# pip >= 25.1 on a machine whose pip version cannot be checked from here.
|
|
# Trading a working install path for a tidier declaration is not a trade
|
|
# worth making blind. The parts of QUA-001 that were real defects — the
|
|
# psycopg dialect and the parasitic packages — are fixed; revisit the
|
|
# consolidation when the deployment gains a build step (OPS-011).
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
pythonpath = ["."]
|
|
addopts = "-q --strict-markers --strict-config"
|
|
filterwarnings = [
|
|
"default",
|
|
# discord.py imports audioop, removed from the stdlib in 3.13.
|
|
"ignore:'audioop' is deprecated:DeprecationWarning",
|
|
# Every model uses datetime.utcnow as a column default. Tracked as
|
|
# DB-009; the warning would otherwise drown the run.
|
|
"ignore:datetime.datetime.utcnow:DeprecationWarning",
|
|
]
|
|
|
|
[tool.ruff]
|
|
line-length = 100
|
|
target-version = "py312"
|
|
exclude = [".venv", "venv", "migrations", "docs"]
|
|
|
|
[tool.ruff.lint]
|
|
# Widened once the repository had been formatted, so that this enforcement
|
|
# is about defects rather than churn (QUA-002). The whole set produced 24
|
|
# findings across 76 files — the code was cleaner than the audit feared.
|
|
#
|
|
# E4/E7/E9, F pyflakes and the pycodestyle subset ruff enables by default
|
|
# B bugbear; B904 alone is worth it (lost exception causes)
|
|
# C4 comprehension shortcuts
|
|
# RET return-flow tidiness
|
|
# SIM obvious simplifications
|
|
# UP syntax available on the 3.12 this targets
|
|
#
|
|
# isort (I) is not enabled yet: it would reorder imports in 48 files, i.e. a
|
|
# second sweep of pure churn right after the formatting commit. Worth doing,
|
|
# worth doing on its own.
|
|
select = ["E4", "E7", "E9", "F", "B", "C4", "RET", "SIM", "UP"]
|
|
|
|
# Forcing a ternary reads worse than the if/else it replaces in the one place
|
|
# it fires (evaluations.py, choosing a sort direction).
|
|
ignore = ["SIM108"]
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
# Intentional re-export facade: `from app.models import User, Tryout, ...`
|
|
# is the documented entry point, and importing the modules is what
|
|
# registers every model with SQLAlchemy.
|
|
"app/models/__init__.py" = ["F401"]
|
|
"app/models/user_model/__init__.py" = ["F401"]
|
|
"tests/conftest.py" = ["E402"]
|
|
|
|
[tool.ruff.format]
|
|
quote-style = "preserve"
|