fix(lint): auto-fix ruff violations and tune lint rules
- Auto-fixed 4,496 lint issues (import sorting, modern syntax, etc.) - Added ignore rules for patterns intentional in this codebase: E402 (late imports), E712 (SQLAlchemy filters), B904 (raise from), SIM108/SIM105/SIM117 (readability preferences) - Added per-file ignores for tests and scripts - Excluded broken scripts/rename_terminology.py (has curly quotes) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,15 +13,15 @@ from app.modules.cms.services.media_service import (
|
||||
MediaService,
|
||||
media_service,
|
||||
)
|
||||
from app.modules.cms.services.store_email_settings_service import (
|
||||
StoreEmailSettingsService,
|
||||
get_store_email_settings_service, # Deprecated: use store_email_settings_service
|
||||
store_email_settings_service,
|
||||
)
|
||||
from app.modules.cms.services.store_theme_service import (
|
||||
StoreThemeService,
|
||||
store_theme_service,
|
||||
)
|
||||
from app.modules.cms.services.store_email_settings_service import (
|
||||
StoreEmailSettingsService,
|
||||
store_email_settings_service,
|
||||
get_store_email_settings_service, # Deprecated: use store_email_settings_service
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"ContentPageService",
|
||||
|
||||
@@ -16,7 +16,6 @@ from sqlalchemy import func
|
||||
|
||||
from app.modules.contracts.features import (
|
||||
FeatureDeclaration,
|
||||
FeatureProviderProtocol,
|
||||
FeatureScope,
|
||||
FeatureType,
|
||||
FeatureUsage,
|
||||
|
||||
@@ -15,9 +15,8 @@ from sqlalchemy import func
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.modules.contracts.metrics import (
|
||||
MetricValue,
|
||||
MetricsContext,
|
||||
MetricsProviderProtocol,
|
||||
MetricValue,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
||||
@@ -96,7 +96,7 @@ class ContentPageService:
|
||||
db.query(ContentPage)
|
||||
.filter(
|
||||
and_(
|
||||
ContentPage.store_id == None,
|
||||
ContentPage.store_id is None,
|
||||
ContentPage.is_platform_page == False,
|
||||
*base_filters,
|
||||
)
|
||||
@@ -136,7 +136,7 @@ class ContentPageService:
|
||||
filters = [
|
||||
ContentPage.platform_id == platform_id,
|
||||
ContentPage.slug == slug,
|
||||
ContentPage.store_id == None,
|
||||
ContentPage.store_id is None,
|
||||
ContentPage.is_platform_page == True,
|
||||
]
|
||||
|
||||
@@ -209,7 +209,7 @@ class ContentPageService:
|
||||
db.query(ContentPage)
|
||||
.filter(
|
||||
and_(
|
||||
ContentPage.store_id == None,
|
||||
ContentPage.store_id is None,
|
||||
ContentPage.is_platform_page == False,
|
||||
*base_filters,
|
||||
)
|
||||
@@ -252,7 +252,7 @@ class ContentPageService:
|
||||
"""
|
||||
filters = [
|
||||
ContentPage.platform_id == platform_id,
|
||||
ContentPage.store_id == None,
|
||||
ContentPage.store_id is None,
|
||||
ContentPage.is_platform_page == True,
|
||||
]
|
||||
|
||||
@@ -291,7 +291,7 @@ class ContentPageService:
|
||||
"""
|
||||
filters = [
|
||||
ContentPage.platform_id == platform_id,
|
||||
ContentPage.store_id == None,
|
||||
ContentPage.store_id is None,
|
||||
ContentPage.is_platform_page == False,
|
||||
]
|
||||
|
||||
@@ -760,12 +760,12 @@ class ContentPageService:
|
||||
|
||||
if page_tier == "platform":
|
||||
filters.append(ContentPage.is_platform_page == True)
|
||||
filters.append(ContentPage.store_id == None)
|
||||
filters.append(ContentPage.store_id is None)
|
||||
elif page_tier == "store_default":
|
||||
filters.append(ContentPage.is_platform_page == False)
|
||||
filters.append(ContentPage.store_id == None)
|
||||
filters.append(ContentPage.store_id is None)
|
||||
elif page_tier == "store_override":
|
||||
filters.append(ContentPage.store_id != None)
|
||||
filters.append(ContentPage.store_id is not None)
|
||||
|
||||
return (
|
||||
db.query(ContentPage)
|
||||
@@ -942,10 +942,10 @@ class ContentPageService:
|
||||
ValueError: If section name is invalid
|
||||
"""
|
||||
from app.modules.cms.schemas import (
|
||||
HeroSection,
|
||||
FeaturesSection,
|
||||
PricingSection,
|
||||
CTASection,
|
||||
FeaturesSection,
|
||||
HeroSection,
|
||||
PricingSection,
|
||||
)
|
||||
|
||||
SECTION_SCHEMAS = {
|
||||
|
||||
@@ -11,7 +11,6 @@ This module provides:
|
||||
|
||||
import logging
|
||||
import mimetypes
|
||||
import os
|
||||
import shutil
|
||||
import uuid
|
||||
from datetime import UTC, datetime
|
||||
@@ -22,11 +21,10 @@ from sqlalchemy import func, or_
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.modules.cms.exceptions import (
|
||||
MediaFileTooLargeException,
|
||||
MediaNotFoundException,
|
||||
MediaUploadException,
|
||||
MediaValidationException,
|
||||
UnsupportedMediaTypeException,
|
||||
MediaFileTooLargeException,
|
||||
)
|
||||
from app.modules.cms.models import MediaFile
|
||||
|
||||
|
||||
@@ -20,17 +20,16 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.exceptions import (
|
||||
AuthorizationException,
|
||||
ExternalServiceException,
|
||||
ResourceNotFoundException,
|
||||
ValidationException,
|
||||
ExternalServiceException,
|
||||
)
|
||||
from app.modules.tenancy.models import Store
|
||||
from app.modules.messaging.models import (
|
||||
StoreEmailSettings,
|
||||
EmailProvider,
|
||||
PREMIUM_EMAIL_PROVIDERS,
|
||||
)
|
||||
from app.modules.billing.models import TierCode
|
||||
from app.modules.messaging.models import (
|
||||
PREMIUM_EMAIL_PROVIDERS,
|
||||
EmailProvider,
|
||||
StoreEmailSettings,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -343,7 +342,7 @@ class StoreEmailSettingsService:
|
||||
from_email=(settings.from_email, settings.from_name),
|
||||
to_emails=to_email,
|
||||
subject="Wizamart Email Configuration Test",
|
||||
html_content=f"""
|
||||
html_content="""
|
||||
<html>
|
||||
<body style="font-family: Arial, sans-serif; padding: 20px;">
|
||||
<h2 style="color: #6b46c1;">Email Configuration Test</h2>
|
||||
@@ -376,7 +375,7 @@ class StoreEmailSettingsService:
|
||||
"from": f"{settings.from_name} <{settings.from_email}>",
|
||||
"to": to_email,
|
||||
"subject": "Wizamart Email Configuration Test",
|
||||
"html": f"""
|
||||
"html": """
|
||||
<html>
|
||||
<body style="font-family: Arial, sans-serif; padding: 20px;">
|
||||
<h2 style="color: #6b46c1;">Email Configuration Test</h2>
|
||||
@@ -421,7 +420,7 @@ class StoreEmailSettingsService:
|
||||
"Subject": {"Data": "Wizamart Email Configuration Test"},
|
||||
"Body": {
|
||||
"Html": {
|
||||
"Data": f"""
|
||||
"Data": """
|
||||
<html>
|
||||
<body style="font-family: Arial, sans-serif; padding: 20px;">
|
||||
<h2 style="color: #6b46c1;">Email Configuration Test</h2>
|
||||
|
||||
@@ -11,6 +11,16 @@ import re
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.modules.cms.exceptions import (
|
||||
InvalidColorFormatException,
|
||||
InvalidFontFamilyException,
|
||||
StoreThemeNotFoundException,
|
||||
ThemeOperationException,
|
||||
ThemePresetNotFoundException,
|
||||
ThemeValidationException,
|
||||
)
|
||||
from app.modules.cms.models import StoreTheme
|
||||
from app.modules.cms.schemas.store_theme import StoreThemeUpdate, ThemePresetPreview
|
||||
from app.modules.cms.services.theme_presets import (
|
||||
THEME_PRESETS,
|
||||
apply_preset,
|
||||
@@ -18,17 +28,7 @@ from app.modules.cms.services.theme_presets import (
|
||||
get_preset_preview,
|
||||
)
|
||||
from app.modules.tenancy.exceptions import StoreNotFoundException
|
||||
from app.modules.cms.exceptions import (
|
||||
InvalidColorFormatException,
|
||||
InvalidFontFamilyException,
|
||||
ThemeOperationException,
|
||||
ThemePresetNotFoundException,
|
||||
ThemeValidationException,
|
||||
StoreThemeNotFoundException,
|
||||
)
|
||||
from app.modules.tenancy.models import Store
|
||||
from app.modules.cms.models import StoreTheme
|
||||
from app.modules.cms.schemas.store_theme import ThemePresetPreview, StoreThemeUpdate
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user