From 91c5539d1f929df38fd3c704a25c967624517bff Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Sat, 6 Dec 2025 20:02:42 +0100 Subject: [PATCH] fix: include FE-001/FE-002 checks in bulk template validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- scripts/validate_architecture.py | 33 ++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/scripts/validate_architecture.py b/scripts/validate_architecture.py index 8094bf24..61ada4fd 100755 --- a/scripts/validate_architecture.py +++ b/scripts/validate_architecture.py @@ -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: