refactor: split architecture rules into domain-specific files
Split the monolithic .architecture-rules.yaml (1700+ lines) into focused domain-specific files in .architecture-rules/ directory: - _main.yaml: Core config, principles, ignore patterns, severity levels - api.yaml: API endpoint rules (API-001 to API-005) - service.yaml: Service layer rules (SVC-001 to SVC-007) - model.yaml: Model rules (MDL-001 to MDL-004) - exception.yaml: Exception handling rules (EXC-001 to EXC-005) - naming.yaml: Naming convention rules (NAM-001 to NAM-005) - auth.yaml: Auth and multi-tenancy rules (AUTH-*, MT-*) - middleware.yaml: Middleware rules (MDW-001 to MDW-002) - frontend.yaml: Frontend rules (JS-*, TPL-*, FE-*, CSS-*) - language.yaml: Language/i18n rules (LANG-001 to LANG-010) - quality.yaml: Code quality rules (QUAL-001 to QUAL-003) Also creates scripts/validators/ module with base classes for future modular validator extraction. The validate_architecture.py loader now auto-detects and merges split YAML files while maintaining backward compatibility with single file mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
22
.architecture-rules/middleware.yaml
Normal file
22
.architecture-rules/middleware.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
# Architecture Rules - Middleware Rules
|
||||
# Rules for middleware/**/*.py files
|
||||
|
||||
middleware_rules:
|
||||
|
||||
- id: "MDW-001"
|
||||
name: "Middleware files use simple nouns without _middleware suffix"
|
||||
severity: "warning"
|
||||
description: |
|
||||
Middleware files should be named with simple nouns (auth.py, not auth_middleware.py)
|
||||
pattern:
|
||||
file_pattern: "middleware/**/*.py"
|
||||
check: "middleware_naming"
|
||||
|
||||
- id: "MDW-002"
|
||||
name: "Vendor context must be injected for vendor/shop routes"
|
||||
severity: "error"
|
||||
description: |
|
||||
Vendor context middleware must set request.state.vendor_id and request.state.vendor
|
||||
pattern:
|
||||
file_pattern: "middleware/vendor_context.py"
|
||||
required: true
|
||||
Reference in New Issue
Block a user