docs(dev): add pre-commit setup instructions to code quality guide
Some checks failed
Some checks failed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user