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

@@ -110,7 +110,7 @@ class LetzshopClientError(MarketplaceException):
self.response = response
class LetzshopAuthenticationError(LetzshopClientError): # noqa: MOD-025
class LetzshopAuthenticationError(LetzshopClientError): # noqa: MOD025
"""Raised when Letzshop authentication fails."""
def __init__(self, message: str = "Letzshop authentication failed"):
@@ -118,7 +118,7 @@ class LetzshopAuthenticationError(LetzshopClientError): # noqa: MOD-025
self.error_code = "LETZSHOP_AUTHENTICATION_FAILED"
class LetzshopCredentialsNotFoundException(ResourceNotFoundException): # noqa: MOD-025
class LetzshopCredentialsNotFoundException(ResourceNotFoundException): # noqa: MOD025
"""Raised when Letzshop credentials not found for store."""
def __init__(self, store_id: int):
@@ -130,7 +130,7 @@ class LetzshopCredentialsNotFoundException(ResourceNotFoundException): # noqa:
self.store_id = store_id
class LetzshopConnectionFailedException(BusinessLogicException): # noqa: MOD-025
class LetzshopConnectionFailedException(BusinessLogicException): # noqa: MOD025
"""Raised when Letzshop API connection test fails."""
def __init__(self, error_message: str):
@@ -158,7 +158,7 @@ class ImportJobNotFoundException(ResourceNotFoundException):
)
class HistoricalImportJobNotFoundException(ResourceNotFoundException): # noqa: MOD-025
class HistoricalImportJobNotFoundException(ResourceNotFoundException): # noqa: MOD025
"""Raised when a historical import job is not found."""
def __init__(self, job_id: int):
@@ -184,7 +184,7 @@ class ImportJobNotOwnedException(AuthorizationException):
)
class ImportJobCannotBeCancelledException(BusinessLogicException): # noqa: MOD-025
class ImportJobCannotBeCancelledException(BusinessLogicException): # noqa: MOD025
"""Raised when trying to cancel job that cannot be cancelled."""
def __init__(self, job_id: int, current_status: str):
@@ -198,7 +198,7 @@ class ImportJobCannotBeCancelledException(BusinessLogicException): # noqa: MOD-
)
class ImportJobCannotBeDeletedException(BusinessLogicException): # noqa: MOD-025
class ImportJobCannotBeDeletedException(BusinessLogicException): # noqa: MOD025
"""Raised when trying to delete job that cannot be deleted."""
def __init__(self, job_id: int, current_status: str):
@@ -212,7 +212,7 @@ class ImportJobCannotBeDeletedException(BusinessLogicException): # noqa: MOD-02
)
class ImportJobAlreadyProcessingException(BusinessLogicException): # noqa: MOD-025
class ImportJobAlreadyProcessingException(BusinessLogicException): # noqa: MOD025
"""Raised when trying to start import while another is already processing."""
def __init__(self, store_code: str, existing_job_id: int):
@@ -238,7 +238,7 @@ class ImportValidationError(MarketplaceException):
self.errors = errors or []
class InvalidImportDataException(ValidationException): # noqa: MOD-025
class InvalidImportDataException(ValidationException): # noqa: MOD025
"""Raised when import data is invalid."""
def __init__(
@@ -262,7 +262,7 @@ class InvalidImportDataException(ValidationException): # noqa: MOD-025
self.error_code = "INVALID_IMPORT_DATA"
class ImportRateLimitException(BusinessLogicException): # noqa: MOD-025
class ImportRateLimitException(BusinessLogicException): # noqa: MOD025
"""Raised when import rate limit is exceeded."""
def __init__(
@@ -291,7 +291,7 @@ class ImportRateLimitException(BusinessLogicException): # noqa: MOD-025
# =============================================================================
class MarketplaceImportException(BusinessLogicException): # noqa: MOD-025
class MarketplaceImportException(BusinessLogicException): # noqa: MOD025
"""Base exception for marketplace import operations."""
def __init__(
@@ -314,7 +314,7 @@ class MarketplaceImportException(BusinessLogicException): # noqa: MOD-025
)
class MarketplaceConnectionException(ExternalServiceException): # noqa: MOD-025
class MarketplaceConnectionException(ExternalServiceException): # noqa: MOD025
"""Raised when marketplace connection fails."""
def __init__(
@@ -327,7 +327,7 @@ class MarketplaceConnectionException(ExternalServiceException): # noqa: MOD-025
)
class MarketplaceDataParsingException(ValidationException): # noqa: MOD-025
class MarketplaceDataParsingException(ValidationException): # noqa: MOD025
"""Raised when marketplace data cannot be parsed."""
def __init__(
@@ -347,7 +347,7 @@ class MarketplaceDataParsingException(ValidationException): # noqa: MOD-025
self.error_code = "MARKETPLACE_DATA_PARSING_FAILED"
class InvalidMarketplaceException(ValidationException): # noqa: MOD-025
class InvalidMarketplaceException(ValidationException): # noqa: MOD025
"""Raised when marketplace is not supported."""
def __init__(self, marketplace: str, supported_marketplaces: list | None = None):
@@ -451,7 +451,7 @@ class MarketplaceProductValidationException(ValidationException):
self.error_code = "PRODUCT_VALIDATION_FAILED"
class InvalidGTINException(ValidationException): # noqa: MOD-025
class InvalidGTINException(ValidationException): # noqa: MOD025
"""Raised when GTIN format is invalid."""
def __init__(self, gtin: str, message: str = "Invalid GTIN format"):
@@ -463,7 +463,7 @@ class InvalidGTINException(ValidationException): # noqa: MOD-025
self.error_code = "INVALID_GTIN"
class MarketplaceProductCSVImportException(BusinessLogicException): # noqa: MOD-025
class MarketplaceProductCSVImportException(BusinessLogicException): # noqa: MOD025
"""Raised when product CSV import fails."""
def __init__(
@@ -490,7 +490,7 @@ class MarketplaceProductCSVImportException(BusinessLogicException): # noqa: MOD
# =============================================================================
class ExportError(MarketplaceException): # noqa: MOD-025
class ExportError(MarketplaceException): # noqa: MOD025
"""Raised when product export fails."""
def __init__(self, message: str, language: str | None = None):