From 85309a9178ecb343a1fa9f6986066c1df4f38723 Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Wed, 31 Dec 2025 21:53:08 +0100 Subject: [PATCH] fix: use word boundary in NAM-004 rule to avoid false positives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The NAM-004 rule was incorrectly matching 'letzshop_id' because it contains 'shop_id' as a substring. Added regex word boundary (\b) to only match standalone 'shop_id' identifiers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- scripts/validate_architecture.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/validate_architecture.py b/scripts/validate_architecture.py index 2f49035a..cb4cdf42 100755 --- a/scripts/validate_architecture.py +++ b/scripts/validate_architecture.py @@ -2515,9 +2515,11 @@ class ArchitectureValidator: # NAM-004: Check for 'shop_id' (should be vendor_id) # Skip shop-specific files where shop_id might be legitimate + # Use word boundary to avoid matching 'letzshop_id' etc. + shop_id_pattern = re.compile(r'\bshop_id\b') if "/shop/" not in str(file_path): for i, line in enumerate(lines, 1): - if "shop_id" in line and "# noqa" not in line.lower(): + if shop_id_pattern.search(line) and "# noqa" not in line.lower(): # Avoid false positives for legitimate shop context if "shop_service" not in str(file_path): self._add_violation(