Eliminate all 103 errors and 96 warnings from the architecture validator: Phase 1 - Validator rules & YAML: - Add NAM-001/NAM-002 exceptions for module-scoped router/service files - Fix API-004 to detect # public comments on decorator lines - Add module-specific exception bases to EXC-004 valid_bases - Exclude storefront files from AUTH-004 store context check - Add SVC-006 exceptions for loyalty service atomic commits - Fix _get_rule() to search naming_rules and auth_rules categories - Use plain # CODE comments instead of # noqa: CODE for custom rules Phase 2 - Billing module (5 route files): - Move _resolve_store_to_merchant to subscription_service - Move tier/feature queries to feature_service, admin_subscription_service - Extract 22 inline Pydantic schemas to billing/schemas/billing.py - Replace all HTTPException with domain exceptions Phase 3 - Loyalty module (4 routes + points_service): - Add 7 domain exceptions (Apple auth, enrollment, device registration) - Add service methods to card_service, program_service, apple_wallet_service - Move all db.query() from routes to service layer - Fix SVC-001: replace HTTPException in points_service with domain exception Phase 4 - Remaining modules: - tenancy: move store stats queries to admin_service - cms: move platform resolution to content_page_service, add NoPlatformSubscriptionException - messaging: move user/customer lookups to messaging_service - Add ConfigDict(from_attributes=True) to ContentPageResponse Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
72 lines
1.9 KiB
YAML
72 lines
1.9 KiB
YAML
# Architecture Rules - Naming Convention Rules
|
|
# Rules for consistent naming across the codebase
|
|
|
|
naming_rules:
|
|
|
|
- id: "NAM-001"
|
|
name: "API files use PLURAL names"
|
|
severity: "error"
|
|
description: |
|
|
API endpoint files should use plural names (vendors.py, products.py)
|
|
pattern:
|
|
file_pattern: "app/api/v1/**/*.py"
|
|
check: "plural_naming"
|
|
exceptions:
|
|
- "__init__.py"
|
|
- "auth.py"
|
|
- "health.py"
|
|
- "store.py"
|
|
- "admin.py"
|
|
- "platform.py"
|
|
- "storefront.py"
|
|
|
|
- id: "NAM-002"
|
|
name: "Service files use SINGULAR + 'service' suffix"
|
|
severity: "error"
|
|
description: |
|
|
Service files should use singular name + _service (vendor_service.py)
|
|
pattern:
|
|
file_pattern:
|
|
- "app/services/**/*.py"
|
|
- "app/modules/*/services/**/*.py"
|
|
check: "service_naming"
|
|
exceptions:
|
|
- "*_features.py"
|
|
- "*_metrics.py"
|
|
- "*_widgets.py"
|
|
- "*_aggregator.py"
|
|
- "*_provider.py"
|
|
- "*_presets.py"
|
|
|
|
- id: "NAM-003"
|
|
name: "Model files use SINGULAR names"
|
|
severity: "error"
|
|
description: |
|
|
Both database and schema model files use singular names (product.py)
|
|
pattern:
|
|
file_pattern:
|
|
- "models/**/*.py"
|
|
- "app/modules/*/models/**/*.py"
|
|
check: "singular_naming"
|
|
|
|
- id: "NAM-004"
|
|
name: "Use consistent terminology: vendor not shop"
|
|
severity: "warning"
|
|
description: |
|
|
Use 'vendor' consistently, not 'shop' (except for storefront)
|
|
pattern:
|
|
file_pattern: "app/**/*.py"
|
|
discouraged_terms:
|
|
- "shop_id"
|
|
- "shop_service"
|
|
|
|
- id: "NAM-005"
|
|
name: "Use consistent terminology: inventory not stock"
|
|
severity: "warning"
|
|
description: |
|
|
Use 'inventory' consistently, not 'stock'
|
|
pattern:
|
|
file_pattern: "app/**/*.py"
|
|
discouraged_terms:
|
|
- "stock_service"
|