fix: include FE-001/FE-002 checks in bulk template validation

The _validate_templates() function was only checking TPL-001 (extends base).
FE-001 (pagination macro) and FE-002 ($icon helper) checks were only run
in single-file mode via _validate_html_file().

Now bulk validation also catches:
- Inline pagination that should use shared/macros/pagination.html
- Inline SVGs that should use $icon() helper

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-06 20:02:42 +01:00
parent 0bfdf331d6
commit 91c5539d1f

View File

@@ -1006,13 +1006,33 @@ class ArchitectureValidator:
]
for file_path in template_files:
# Skip base template and partials
if "base.html" in file_path.name or "partials" in str(file_path):
continue
file_path_str = str(file_path)
# Check exclusion patterns
# Skip base template and partials
is_base_or_partial = "base.html" in file_path.name or "partials" in file_path_str
# Skip macros directory for FE rules
is_macro = "shared/macros/" in file_path_str or "shared\\macros\\" in file_path_str
# Skip components showcase page
is_components_page = "components.html" in file_path.name
content = file_path.read_text()
lines = content.split("\n")
# FE-001: Check for inline pagination (should use macro)
if not is_base_or_partial and not is_macro and not is_components_page:
self._check_pagination_macro_usage(file_path, content, lines)
# FE-002: Check for inline SVGs (should use $icon())
if not is_base_or_partial and not is_macro and not is_components_page:
self._check_icon_helper_usage(file_path, content, lines)
# Skip base/partials for TPL-001 check
if is_base_or_partial:
continue
# Check exclusion patterns for TPL-001
skip = False
for exclusion in tpl_001_exclusions:
if exclusion in file_path_str:
@@ -1021,9 +1041,6 @@ class ArchitectureValidator:
if skip:
continue
content = file_path.read_text()
lines = content.split("\n")
# Check for standalone marker in template (first 5 lines)
first_lines = "\n".join(lines[:5]).lower()
if "standalone" in first_lines or "noqa: tpl-001" in first_lines: