Merged
Conversation
+ Remove @staticmethod from services (Article, Comment, Login) to enable constructor‑based db_session injection. + Add type hints (PEP 484) and Google‑style docstrings across all service methods. + Introduce app/constants.py with a Role enum to eliminate magic strings (e.g., "admin"). + Update controllers to instantiate services with an injected database session. + Update the test_services/ suite to support the new DI pattern and maintain full test pass rate.
…484 type hints across the entire codebase, covering models, controllers, utilities, Flask routes, database configuration, and test factories/fixtures to improve clarity, consistency and maintainability
…ic strings with enums, extract pagination config, streamline controller logic and update tests to align with new standards
…sues (Pyright/Pylance errors, unified Google-style docs, stricter controller return types)
90e06d1 to
f6f914d
Compare
…ey are handled there
…parts of the code using Ruff
hlargitte
approved these changes
Mar 1, 2026
hlargitte
approved these changes
Mar 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimisation Globale, Sécurité et Standardisation Qualité
Cette Pull Request marque une étape majeure dans la maturité technique du projet. L'objectif était de transformer le prototype initial en une application robuste, strictement typée, documentée et protégée par une intégration continue (CI).
🚀 Résumé des Changements
1. Refactorisation Architecture & Code (SOLID/DRY)
app/utilsversapp/controllers/decorators.pypour isoler les dépendances Web (Flask) dans la couche appropriée et nettoyage du dossier utils.Role,SessionKeyetPaginationConfig.2. Sécurité & Contrôle d'Accès
@login_requiredet@roles_acceptedpour centraliser la gestion de l'authentification et des rôles (Admin, Author, User).3. Qualité, Typage & Modernisation
str | Responsepour les retours de contrôleurs.|(pipe) pour les Unions et Optionals.Args:etReturns:exhaustives).4. Infrastructure & Standardisation
pytest,pyrightetruffsur chaque Pull Request.__init__.pymanquants pour garantir une structure de package Python cohérente.🛠️ Validation Technique
pytest).pyright.ruff.📦 Contenu de la PR (Fichiers clés)
app/controllers/decorators.py: Nouveaux outils de sécurité (Relocalisés).app/constants.py: Centralisation des configurations et rôles..github/workflows/continuous-integration.yml: Configuration de la CI.app/controllers/et des services dansapp/services/.