feat(validators): add noqa suppression support to security and performance validators
All checks were successful
CI / dependency-scanning (push) Successful in 27s
CI / docs (push) Successful in 35s
CI / ruff (push) Successful in 8s
CI / pytest (push) Successful in 34m22s
CI / validate (push) Successful in 19s
CI / deploy (push) Successful in 2m25s

- Add centralized _is_noqa_suppressed() to BaseValidator with normalization
  (accepts both SEC001 and SEC-001 formats for ruff compatibility)
- Wire noqa support into all 21 security and 18 performance check functions
- Add ruff external config for SEC/PERF/MOD/EXC codes in pyproject.toml
- Convert all 280 Python noqa comments to dashless format (ruff-compatible)
- Add site/ to IGNORE_PATTERNS (excludes mkdocs build output)
- Suppress 152 false positive findings (test passwords, seed data, validator
  self-references, Apple Wallet SHA1, etc.)
- Security: 79 errors → 0, 60 warnings → 0
- Performance: 80 warnings → 77 (3 test script suppressions)
- Add proposal doc with noqa inventory and remaining findings recommendations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 22:56:56 +01:00
parent f84c5d903e
commit 1b8a40f1ff
75 changed files with 404 additions and 310 deletions

View File

@@ -69,7 +69,7 @@ class ContentPageNotFoundException(ResourceNotFoundException):
)
class ContentPageAlreadyExistsException(ConflictException): # noqa: MOD-025
class ContentPageAlreadyExistsException(ConflictException): # noqa: MOD025
"""Raised when a content page with the same slug already exists."""
def __init__(self, slug: str, store_id: int | None = None):
@@ -84,7 +84,7 @@ class ContentPageAlreadyExistsException(ConflictException): # noqa: MOD-025
)
class ContentPageSlugReservedException(ValidationException): # noqa: MOD-025
class ContentPageSlugReservedException(ValidationException): # noqa: MOD025
"""Raised when trying to use a reserved slug."""
def __init__(self, slug: str):
@@ -96,7 +96,7 @@ class ContentPageSlugReservedException(ValidationException): # noqa: MOD-025
self.error_code = "CONTENT_PAGE_SLUG_RESERVED"
class ContentPageNotPublishedException(BusinessLogicException): # noqa: MOD-025
class ContentPageNotPublishedException(BusinessLogicException): # noqa: MOD025
"""Raised when trying to access an unpublished content page."""
def __init__(self, slug: str):
@@ -118,7 +118,7 @@ class UnauthorizedContentPageAccessException(AuthorizationException):
)
class StoreNotAssociatedException(AuthorizationException): # noqa: MOD-025
class StoreNotAssociatedException(AuthorizationException): # noqa: MOD025
"""Raised when a user is not associated with a store."""
def __init__(self):
@@ -143,7 +143,7 @@ class NoPlatformSubscriptionException(BusinessLogicException):
)
class ContentPageValidationException(ValidationException): # noqa: MOD-025
class ContentPageValidationException(ValidationException): # noqa: MOD025
"""Raised when content page data validation fails."""
def __init__(self, field: str, message: str, value: str | None = None):
@@ -175,7 +175,7 @@ class MediaNotFoundException(ResourceNotFoundException):
)
class MediaUploadException(BusinessLogicException): # noqa: MOD-025
class MediaUploadException(BusinessLogicException): # noqa: MOD025
"""Raised when media upload fails."""
def __init__(self, message: str = "Media upload failed", details: dict[str, Any] | None = None):
@@ -241,7 +241,7 @@ class MediaOptimizationException(BusinessLogicException):
)
class MediaDeleteException(BusinessLogicException): # noqa: MOD-025
class MediaDeleteException(BusinessLogicException): # noqa: MOD025
"""Raised when media deletion fails."""
def __init__(self, message: str, details: dict[str, Any] | None = None):
@@ -269,7 +269,7 @@ class StoreThemeNotFoundException(ResourceNotFoundException):
)
class InvalidThemeDataException(ValidationException): # noqa: MOD-025
class InvalidThemeDataException(ValidationException): # noqa: MOD025
"""Raised when theme data is invalid."""
def __init__(
@@ -321,7 +321,7 @@ class ThemeValidationException(ValidationException):
self.error_code = "THEME_VALIDATION_FAILED"
class ThemePresetAlreadyAppliedException(BusinessLogicException): # noqa: MOD-025
class ThemePresetAlreadyAppliedException(BusinessLogicException): # noqa: MOD025
"""Raised when trying to apply the same preset that's already active."""
def __init__(self, preset_name: str, store_code: str):

View File

@@ -234,7 +234,7 @@ function contentPageEditor(pageId) {
const quill = quillContainer.__quill;
if (this.form.content && quill.root.innerHTML !== this.form.content) {
quill.root.innerHTML = this.form.content;
quill.root.innerHTML = this.form.content; // # noqa: SEC-015
contentPageEditLog.debug('Synced Quill content after page load');
}
},

View File

@@ -40,7 +40,7 @@
<div class="w-16 h-16 mx-auto mb-4 rounded-full gradient-primary flex items-center justify-center">
{# Support for icon names - rendered via Alpine $icon helper or direct SVG #}
{% if feature.icon.startswith('<svg') %}
{{ feature.icon | safe }}
{{ feature.icon | safe }} <!-- noqa: SEC-015 -->
{% else %}
<span x-html="typeof $icon !== 'undefined' ? $icon('{{ feature.icon }}', 'w-8 h-8 text-white') : ''"></span>
{% endif %}