diff --git a/README.md b/README.md index 9c1e85f..a941013 100644 --- a/README.md +++ b/README.md @@ -511,6 +511,68 @@ fi python -m laborious.worker.worker ``` +## Code Quality & Validation + +### Overview + +Since Python is not compiled, we validate quality, security, and correctness before execution. + +### Validation Tools + +- Ruff: Linting and formatting +- mypy: Static type checking +- Bandit: Security analysis +- pytest: Unit/integration testing with coverage + +### Tools Installation + +```bash +pip install -r requirements-dev.txt +``` + +### Complete Validation + +Option 1 (recommended): +```bash +./validate.sh +``` +The script runs, in order: +1. Format check (Ruff) +2. Linting (Ruff) +3. Type checking (mypy) +4. Security analysis (Bandit) +5. Tests with coverage (pytest) + +Option 2 (individual commands): +```bash +ruff format --check laborious/ tests/ +ruff check laborious/ tests/ +mypy laborious/ +bandit -r laborious/ -ll +pytest tests/ --cov=laborious --cov-report=term-missing +``` + +### Automatic Fixes + +```bash +ruff format laborious/ tests/ +ruff check --fix laborious/ tests/ +``` + +### Configuration + +All settings reside in `pyproject.toml` (Ruff, mypy, pytest, Bandit). + +### CI/CD Integration + +The workflow at `.github/workflows/quality-gate.yml` executes validations on each push/PR. + +### Best Practices + +- Run `./validate.sh` before committing +- Use `ruff check --watch` for continuous feedback +- Add type hints and tests for new code + ## 🧪 Testing ### Test Structure