From 8dcc4145aa3d996724eae48192b7433fa5d3fd47 Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Fri, 13 Feb 2026 22:01:48 +0100 Subject: [PATCH] docs(dev): add pre-commit setup instructions to code quality guide Co-Authored-By: Claude Opus 4.6 --- docs/development/code-quality.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/development/code-quality.md b/docs/development/code-quality.md index 869c71da..f223f9bd 100644 --- a/docs/development/code-quality.md +++ b/docs/development/code-quality.md @@ -7,11 +7,30 @@ This guide covers the code quality tools and standards used in the Wizamart plat The project uses modern Python tooling to maintain high code quality: - **Ruff** - All-in-one linter and formatter (replaces black, isort, flake8, and more) +- **pre-commit** - Git hooks that auto-fix lint issues before each commit - **mypy** - Static type checker - **pytest** - Testing framework with coverage reporting All tools are configured in `pyproject.toml` for consistency and ease of use. +## Setup (after cloning) + +```bash +# Install dev dependencies (includes ruff, pre-commit, mypy) +pip install -r requirements-dev.txt + +# Install pre-commit git hooks (required once per clone) +pre-commit install +``` + +The pre-commit hook runs automatically on every `git commit` and will: + +- Validate architecture patterns +- Fix trailing whitespace and missing end-of-file newlines +- Auto-fix ruff lint issues (import sorting, unused imports, etc.) + +If a hook modifies files (e.g. fixes imports), the commit is aborted. Simply `git add` the fixed files and commit again. + ## Quick Start ```bash @@ -26,6 +45,9 @@ make check # Strict linting (no auto-fix) - for CI/CD make lint-strict + +# Run pre-commit hooks manually on all files +pre-commit run --all-files ``` ## Ruff - Modern Linting and Formatting