feat(validators): add noqa suppression support to security and performance validators
All checks were successful
All checks were successful
- 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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user