chore(lint): trier les imports, sauf la facade des modeles

Active la regle isort (I) de ruff. 45 fichiers reordonnes, aucun
changement de comportement : la suite passe avant comme apres.

app/models/__init__.py en est exclu. Ses imports sont ranges en onze
couches commentees qui decrivent le graphe de dependances ; trier par
ordre alphabetique laisse chaque titre au-dessus d un import qu il ne
decrit pas, et ce fichier n a qu un role, etre lu.

Commit isole, comme le formatage : un diff de brassage ne doit pas
servir de couverture a un changement de comportement.
This commit is contained in:
GGThed
2026-08-11 11:40:41 -04:00
parent ab0b975211
commit 47ff544848
45 changed files with 213 additions and 170 deletions
+12 -6
View File
@@ -42,11 +42,10 @@ exclude = [".venv", "venv", "migrations", "docs"]
# 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"]
# I isort; enabled in its own commit, for the same reason the
# formatting got one — the diff is churn and must not hide
# behind a behavioural change
select = ["E4", "E7", "E9", "F", "B", "C4", "RET", "SIM", "UP", "I"]
# Forcing a ternary reads worse than the if/else it replaces in the one place
# it fires (evaluations.py, choosing a sort direction).
@@ -56,7 +55,14 @@ ignore = ["SIM108"]
# 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"]
#
# I001 is off here too. The imports are grouped into eleven commented
# layers that spell out the dependency graph (constants → users → teams →
# tryouts → matches → participants). Alphabetising them leaves every
# heading above an import it does not describe, and the file's one job is
# to be read. The order is documentation, not a requirement: the suite
# passes either way.
"app/models/__init__.py" = ["F401", "I001"]
"app/models/user_model/__init__.py" = ["F401"]
"tests/conftest.py" = ["E402"]