- Correction des 907 erreurs ruff (pathlib, imports, nommage, simplifications, docstrings) - Fix déduplication labels dans multiselect nœuds d'arrivée (analyse) - Expansion 1→N label→IDs pour le Sankey (Pays d'opération) - Ajout CLAUDE.md et document de design de l'audit - Mise à jour .gitignore (artefacts tests exploratoires) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
95 lines
3.0 KiB
TOML
95 lines
3.0 KiB
TOML
[project]
|
|
name = "fabnum"
|
|
version = "1.0.0"
|
|
description = "Analyse de risques géopolitiques pour les chaînes d'approvisionnement numériques"
|
|
requires-python = ">=3.10"
|
|
|
|
[tool.ruff]
|
|
# Longueur de ligne maximale
|
|
line-length = 120
|
|
|
|
# Version Python cible
|
|
target-version = "py310"
|
|
|
|
# Répertoires à exclure de l'analyse
|
|
exclude = [
|
|
".git",
|
|
".venv",
|
|
"venv",
|
|
"__pycache__",
|
|
"*.pyc",
|
|
".pytest_cache",
|
|
"logs",
|
|
"pgpt", # PrivateGPT externe
|
|
"IA", # Module IA priorité basse
|
|
"batch_ia", # Module batch_ia priorité basse
|
|
]
|
|
|
|
[tool.ruff.lint]
|
|
# Règles activées (sélection équilibrée pour un projet existant)
|
|
select = [
|
|
"E", # pycodestyle errors
|
|
"W", # pycodestyle warnings
|
|
"F", # pyflakes
|
|
"I", # isort (tri des imports)
|
|
"N", # pep8-naming
|
|
"D", # pydocstyle (docstrings)
|
|
"UP", # pyupgrade (syntaxe Python moderne)
|
|
"B", # flake8-bugbear (détection de bugs)
|
|
"C4", # flake8-comprehensions
|
|
"PIE", # flake8-pie
|
|
"RET", # flake8-return
|
|
"SIM", # flake8-simplify
|
|
"ARG", # flake8-unused-arguments
|
|
"PTH", # flake8-use-pathlib
|
|
]
|
|
|
|
# Règles à ignorer (pour éviter trop de changements d'un coup)
|
|
ignore = [
|
|
"D100", # Missing docstring in public module (trop strict)
|
|
"D104", # Missing docstring in public package
|
|
"D203", # 1 blank line required before class docstring (conflit avec D211)
|
|
"D213", # Multi-line docstring summary should start at the second line (conflit avec D212)
|
|
"E501", # Line too long (géré par line-length)
|
|
"N802", # Function name should be lowercase (streamlit utilise des noms de fonctions variés)
|
|
"N803", # Argument name should be lowercase (pour compatibilité avec NetworkX : G)
|
|
"N806", # Variable in function should be lowercase (pour compatibilité avec NetworkX)
|
|
]
|
|
|
|
# Fichiers à ignorer pour certaines règles
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"__init__.py" = ["F401"] # Imports non utilisés dans __init__ sont OK
|
|
"tests/**/*.py" = ["D103", "ARG001", "ARG002", "SIM300"] # Tests: pas de docstrings, mocks @patch inutilisés OK, Yoda conditions OK
|
|
"scripts/**/*.py" = ["D"] # Pas de docstrings obligatoires dans les scripts
|
|
"fabnum.py" = ["E402"] # Streamlit impose st.set_page_config() avant les imports d'app modules
|
|
|
|
[tool.ruff.lint.pydocstyle]
|
|
# Convention de docstrings (Google style)
|
|
convention = "google"
|
|
|
|
[tool.ruff.lint.isort]
|
|
# Configuration du tri des imports
|
|
known-first-party = ["app", "utils", "batch_ia"]
|
|
section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]
|
|
|
|
[tool.ruff.format]
|
|
# Configuration du formateur de code
|
|
quote-style = "double"
|
|
indent-style = "space"
|
|
line-ending = "auto"
|
|
|
|
[tool.pytest.ini_options]
|
|
# Configuration pytest (déjà utilisée)
|
|
testpaths = ["tests"]
|
|
python_files = ["test_*.py"]
|
|
python_functions = ["test_*"]
|
|
addopts = [
|
|
"-v",
|
|
"--tb=short",
|
|
"--strict-markers",
|
|
]
|
|
markers = [
|
|
"unit: Unit tests",
|
|
"integration: Integration tests",
|
|
]
|