docs(arch): integrate architecture validation into QA workflow

- Add arch-check, arch-check-file, arch-check-object Makefile targets
- Include arch-check in QA target for CI integration
- Update architecture-rules.md with CLI usage examples
- Update code-quality.md with validation commands

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-03 21:31:41 +01:00
parent 69aff0ca30
commit 96bdb07fb2
3 changed files with 131 additions and 9 deletions

View File

@@ -171,9 +171,12 @@ show_missing = true
| `make format` | Format code with Ruff | Before committing |
| `make lint` | Lint and auto-fix with Ruff + mypy | Before committing |
| `make lint-strict` | Lint without auto-fix + mypy | In CI/CD pipelines |
| `make arch-check` | Validate architecture patterns | Before committing |
| `make arch-check-file file="path"` | Check a single file | Quick validation |
| `make arch-check-object name="company"` | Check all files for an entity | Entity-wide validation |
| `make check` | Run format + lint | Quick pre-commit check |
| `make ci` | Full CI pipeline (strict lint + coverage) | CI/CD workflows |
| `make qa` | Quality assurance (format + lint + coverage + docs) | Before releases |
| `make qa` | Quality assurance (format + lint + arch-check + coverage + docs) | Before releases |
### Testing Commands
@@ -185,6 +188,51 @@ show_missing = true
| `make test-coverage` | Run tests with coverage report |
| `make test-fast` | Run fast tests (skip slow ones) |
## Architecture Validation
The architecture validator ensures code follows established patterns and best practices.
### Quick Start
```bash
# Check all files
make arch-check
# Check a single file
make arch-check-file file="app/api/v1/admin/vendors.py"
# Check all files related to an entity
make arch-check-object name="company"
make arch-check-object name="vendor"
```
### What It Checks
| Category | Examples |
|----------|----------|
| **API Endpoints** | Pydantic models, no business logic, exception handling, auth |
| **Service Layer** | No HTTPException, proper exceptions, DB session as param |
| **Models** | SQLAlchemy/Pydantic separation |
| **JavaScript** | Centralized logger, apiClient usage |
| **Templates** | Base template inheritance |
### Output
The validator provides a summary table showing pass/fail status per file:
```
📋 FILE SUMMARY:
--------------------------------------------------------------------------------
File Status Errors Warnings
----------------------------- -------- ------- --------
app/api/v1/admin/companies.py ❌ FAILED 6 9
app/services/company_service.py ✅ PASSED 0 0
--------------------------------------------------------------------------------
Total: 2 files | ✅ 1 passed | ❌ 1 failed | 6 errors | 9 warnings
```
See [Architecture Rules Reference](architecture-rules.md) for detailed rule documentation.
## Pre-Commit Workflow
Before committing code:
@@ -193,10 +241,13 @@ Before committing code:
# 1. Format, lint, and verify critical imports
make check
# 2. Run relevant tests
# 2. Validate architecture patterns
make arch-check
# 3. Run relevant tests
make test-fast
# 3. If all passes, commit
# 4. If all passes, commit
git add .
git commit -m "your message"
```