fix: use word boundary in NAM-004 rule to avoid false positives

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 <noreply@anthropic.com>
This commit is contained in:
2025-12-31 21:53:08 +01:00
parent 3f4eab90b8
commit 85309a9178

View File

@@ -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(