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:
@@ -25,7 +25,7 @@ def __getattr__(name: str):
|
||||
from app.modules.analytics.definition import analytics_module
|
||||
|
||||
return analytics_module
|
||||
elif name == "get_analytics_module_with_routers":
|
||||
if name == "get_analytics_module_with_routers":
|
||||
from app.modules.analytics.definition import get_analytics_module_with_routers
|
||||
|
||||
return get_analytics_module_with_routers
|
||||
|
||||
@@ -6,7 +6,12 @@ Defines the analytics module including its features, menu items,
|
||||
route configurations, and self-contained module settings.
|
||||
"""
|
||||
|
||||
from app.modules.base import MenuItemDefinition, MenuSectionDefinition, ModuleDefinition, PermissionDefinition
|
||||
from app.modules.base import (
|
||||
MenuItemDefinition,
|
||||
MenuSectionDefinition,
|
||||
ModuleDefinition,
|
||||
PermissionDefinition,
|
||||
)
|
||||
from app.modules.enums import FrontendType
|
||||
|
||||
|
||||
@@ -26,7 +31,9 @@ def _get_store_page_router():
|
||||
|
||||
def _get_feature_provider():
|
||||
"""Lazy import of feature provider to avoid circular imports."""
|
||||
from app.modules.analytics.services.analytics_features import analytics_feature_provider
|
||||
from app.modules.analytics.services.analytics_features import (
|
||||
analytics_feature_provider,
|
||||
)
|
||||
|
||||
return analytics_feature_provider
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ def __getattr__(name: str):
|
||||
if name == "store_api_router":
|
||||
from app.modules.analytics.routes.api import store_router
|
||||
return store_router
|
||||
elif name == "store_page_router":
|
||||
if name == "store_page_router":
|
||||
from app.modules.analytics.routes.pages import store_router
|
||||
return store_router
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
|
||||
@@ -16,14 +16,14 @@ from fastapi import APIRouter, Depends, Query
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.api.deps import get_current_store_api, get_db, require_module_access
|
||||
from app.modules.billing.dependencies.feature_gate import RequireFeature
|
||||
from app.modules.analytics.services import stats_service
|
||||
from app.modules.analytics.schemas import (
|
||||
StoreAnalyticsCatalog,
|
||||
StoreAnalyticsImports,
|
||||
StoreAnalyticsInventory,
|
||||
StoreAnalyticsResponse,
|
||||
)
|
||||
from app.modules.analytics.services import stats_service
|
||||
from app.modules.billing.dependencies.feature_gate import RequireFeature
|
||||
from app.modules.enums import FrontendType
|
||||
from app.modules.tenancy.models import User
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.api.deps import get_db, require_menu_access
|
||||
from app.modules.core.utils.page_context import get_admin_context
|
||||
from app.templates_config import templates
|
||||
from app.modules.enums import FrontendType
|
||||
from app.modules.tenancy.models import User
|
||||
from app.templates_config import templates
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@ from fastapi.responses import HTMLResponse
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.api.deps import get_current_store_from_cookie_or_header, get_db
|
||||
from app.modules.core.services.platform_settings_service import platform_settings_service # noqa: MOD-004 - shared platform service
|
||||
from app.modules.core.services.platform_settings_service import (
|
||||
platform_settings_service, # noqa: MOD-004 - shared platform service
|
||||
)
|
||||
from app.modules.tenancy.models import Store, User
|
||||
from app.templates_config import templates
|
||||
from app.modules.tenancy.models import User
|
||||
from app.modules.tenancy.models import Store
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -6,29 +6,29 @@ This is the canonical location for analytics schemas.
|
||||
"""
|
||||
|
||||
from app.modules.analytics.schemas.stats import (
|
||||
StatsResponse,
|
||||
MarketplaceStatsResponse,
|
||||
ImportStatsResponse,
|
||||
UserStatsResponse,
|
||||
StoreStatsResponse,
|
||||
ProductStatsResponse,
|
||||
PlatformStatsResponse,
|
||||
OrderStatsBasicResponse,
|
||||
AdminDashboardResponse,
|
||||
StoreProductStats,
|
||||
StoreOrderStats,
|
||||
StoreCustomerStats,
|
||||
StoreRevenueStats,
|
||||
StoreInfo,
|
||||
StoreDashboardStatsResponse,
|
||||
StoreAnalyticsImports,
|
||||
StoreAnalyticsCatalog,
|
||||
StoreAnalyticsInventory,
|
||||
StoreAnalyticsResponse,
|
||||
ValidatorStats,
|
||||
CodeQualityDashboardStatsResponse,
|
||||
CustomerStatsResponse,
|
||||
ImportStatsResponse,
|
||||
MarketplaceStatsResponse,
|
||||
OrderStatsBasicResponse,
|
||||
OrderStatsResponse,
|
||||
PlatformStatsResponse,
|
||||
ProductStatsResponse,
|
||||
StatsResponse,
|
||||
StoreAnalyticsCatalog,
|
||||
StoreAnalyticsImports,
|
||||
StoreAnalyticsInventory,
|
||||
StoreAnalyticsResponse,
|
||||
StoreCustomerStats,
|
||||
StoreDashboardStatsResponse,
|
||||
StoreInfo,
|
||||
StoreOrderStats,
|
||||
StoreProductStats,
|
||||
StoreRevenueStats,
|
||||
StoreStatsResponse,
|
||||
UserStatsResponse,
|
||||
ValidatorStats,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
|
||||
@@ -23,7 +23,6 @@ from app.modules.core.schemas.dashboard import (
|
||||
PlatformStatsResponse,
|
||||
ProductStatsResponse,
|
||||
StatsResponse,
|
||||
UserStatsResponse,
|
||||
StoreCustomerStats,
|
||||
StoreDashboardStatsResponse,
|
||||
StoreInfo,
|
||||
@@ -31,9 +30,9 @@ from app.modules.core.schemas.dashboard import (
|
||||
StoreProductStats,
|
||||
StoreRevenueStats,
|
||||
StoreStatsResponse,
|
||||
UserStatsResponse,
|
||||
)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Store Analytics (Analytics-specific, not in core)
|
||||
# ============================================================================
|
||||
|
||||
@@ -6,8 +6,8 @@ This is the canonical location for analytics services.
|
||||
"""
|
||||
|
||||
from app.modules.analytics.services.stats_service import (
|
||||
stats_service,
|
||||
StatsService,
|
||||
stats_service,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
|
||||
@@ -12,11 +12,8 @@ from __future__ import annotations
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import func
|
||||
|
||||
from app.modules.contracts.features import (
|
||||
FeatureDeclaration,
|
||||
FeatureProviderProtocol,
|
||||
FeatureScope,
|
||||
FeatureType,
|
||||
FeatureUsage,
|
||||
|
||||
@@ -18,14 +18,16 @@ from typing import Any
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.modules.tenancy.exceptions import AdminOperationException, StoreNotFoundException
|
||||
from app.modules.catalog.models import Product
|
||||
from app.modules.customers.models.customer import Customer
|
||||
from app.modules.inventory.models import Inventory
|
||||
from app.modules.marketplace.models import MarketplaceImportJob, MarketplaceProduct
|
||||
from app.modules.orders.models import Order
|
||||
from app.modules.catalog.models import Product
|
||||
from app.modules.tenancy.models import User
|
||||
from app.modules.tenancy.models import Store
|
||||
from app.modules.tenancy.exceptions import (
|
||||
AdminOperationException,
|
||||
StoreNotFoundException,
|
||||
)
|
||||
from app.modules.tenancy.models import Store, User
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user