fix(lint): use plain comments for architecture validator codes
Replace # noqa: SVC-006 with # SVC-006 to avoid ruff warnings about unknown codes. Updated architecture validators to match the new format by checking for the code string directly instead of the noqa: prefix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2086,7 +2086,7 @@ class ArchitectureValidator:
|
||||
return
|
||||
|
||||
# Check for noqa
|
||||
if "noqa: api-007" in content.lower():
|
||||
if "api-007" in content.lower():
|
||||
return
|
||||
|
||||
# Patterns that indicate direct model imports
|
||||
@@ -2102,7 +2102,7 @@ class ArchitectureValidator:
|
||||
continue
|
||||
|
||||
# Check for noqa on this specific line
|
||||
if "noqa: api-007" in line.lower():
|
||||
if "api-007" in line.lower():
|
||||
continue
|
||||
|
||||
for pattern, message in model_import_patterns:
|
||||
@@ -2291,7 +2291,7 @@ class ArchitectureValidator:
|
||||
return
|
||||
|
||||
# Check for file-level noqa comment
|
||||
if "noqa: svc-006" in content.lower():
|
||||
if "svc-006" in content.lower():
|
||||
return
|
||||
|
||||
for i, line in enumerate(lines, 1):
|
||||
@@ -2302,7 +2302,7 @@ class ArchitectureValidator:
|
||||
continue
|
||||
|
||||
# Skip if line has inline noqa comment
|
||||
if "noqa: svc-006" in line.lower():
|
||||
if "svc-006" in line.lower():
|
||||
continue
|
||||
|
||||
self._add_violation(
|
||||
@@ -2313,7 +2313,7 @@ class ArchitectureValidator:
|
||||
line_number=i,
|
||||
message="Service calls db.commit() - transaction control should be at endpoint level",
|
||||
context=stripped,
|
||||
suggestion="Remove db.commit() from service; let endpoint handle transaction. For background tasks, add # noqa: SVC-006",
|
||||
suggestion="Remove db.commit() from service; let endpoint handle transaction. For background tasks, add # SVC-006",
|
||||
)
|
||||
|
||||
def _validate_models(self, target_path: Path):
|
||||
@@ -4097,7 +4097,7 @@ class ArchitectureValidator:
|
||||
for i, line in enumerate(lines, 1):
|
||||
if "from app.services." in line:
|
||||
# Skip if line has noqa comment
|
||||
if "noqa: mod-004" in line.lower():
|
||||
if "mod-004" in line.lower():
|
||||
continue
|
||||
self._add_violation(
|
||||
rule_id="MOD-004",
|
||||
|
||||
Reference in New Issue
Block a user