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:
4
tests/fixtures/admin_platform_fixtures.py
vendored
4
tests/fixtures/admin_platform_fixtures.py
vendored
@@ -9,9 +9,7 @@ import uuid
|
||||
|
||||
import pytest
|
||||
|
||||
from app.modules.tenancy.models import AdminPlatform
|
||||
from app.modules.tenancy.models import Platform
|
||||
from app.modules.tenancy.models import User
|
||||
from app.modules.tenancy.models import AdminPlatform, Platform, User
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
2
tests/fixtures/auth_fixtures.py
vendored
2
tests/fixtures/auth_fixtures.py
vendored
@@ -10,8 +10,8 @@ import uuid
|
||||
|
||||
import pytest
|
||||
|
||||
from middleware.auth import AuthManager
|
||||
from app.modules.tenancy.models import User
|
||||
from middleware.auth import AuthManager
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
||||
6
tests/fixtures/customer_fixtures.py
vendored
6
tests/fixtures/customer_fixtures.py
vendored
@@ -6,6 +6,8 @@ Note: Fixtures should NOT use db.expunge() as it breaks lazy loading.
|
||||
See tests/conftest.py for details on fixture best practices.
|
||||
"""
|
||||
|
||||
from datetime import UTC
|
||||
|
||||
import pytest
|
||||
|
||||
from app.modules.customers.models.customer import Customer, CustomerAddress
|
||||
@@ -104,7 +106,7 @@ def test_customer_multiple_addresses(db, test_store, test_customer):
|
||||
@pytest.fixture
|
||||
def test_order(db, test_store, test_customer, test_customer_address):
|
||||
"""Create a test order with customer/address snapshots."""
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime
|
||||
|
||||
order = Order(
|
||||
store_id=test_store.id,
|
||||
@@ -115,7 +117,7 @@ def test_order(db, test_store, test_customer, test_customer_address):
|
||||
subtotal=99.99,
|
||||
total_amount=99.99,
|
||||
currency="EUR",
|
||||
order_date=datetime.now(timezone.utc),
|
||||
order_date=datetime.now(UTC),
|
||||
# Customer snapshot
|
||||
customer_first_name=test_customer.first_name,
|
||||
customer_last_name=test_customer.last_name,
|
||||
|
||||
10
tests/fixtures/message_fixtures.py
vendored
10
tests/fixtures/message_fixtures.py
vendored
@@ -6,6 +6,8 @@ Note: Fixtures should NOT use db.expunge() as it breaks lazy loading.
|
||||
See tests/conftest.py for details on fixture best practices.
|
||||
"""
|
||||
|
||||
from datetime import UTC
|
||||
|
||||
import pytest
|
||||
|
||||
from app.modules.messaging.models import (
|
||||
@@ -171,14 +173,14 @@ def test_message_with_attachment(db, test_conversation_admin_store, test_admin):
|
||||
@pytest.fixture
|
||||
def closed_conversation(db, test_admin, test_store_user, test_store):
|
||||
"""Create a closed conversation."""
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime
|
||||
|
||||
conversation = Conversation(
|
||||
conversation_type=ConversationType.ADMIN_STORE,
|
||||
subject="Closed Conversation",
|
||||
store_id=test_store.id,
|
||||
is_closed=True,
|
||||
closed_at=datetime.now(timezone.utc),
|
||||
closed_at=datetime.now(UTC),
|
||||
closed_by_type=ParticipantType.ADMIN,
|
||||
closed_by_id=test_admin.id,
|
||||
)
|
||||
@@ -314,14 +316,14 @@ def store_api_conversation(db, test_admin, test_store_user, test_store_with_stor
|
||||
@pytest.fixture
|
||||
def store_api_closed_conversation(db, test_admin, test_store_user, test_store_with_store_user):
|
||||
"""Create a closed conversation for store API tests."""
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime
|
||||
|
||||
conversation = Conversation(
|
||||
conversation_type=ConversationType.ADMIN_STORE,
|
||||
subject="Store API Closed Conversation",
|
||||
store_id=test_store_with_store_user.id,
|
||||
is_closed=True,
|
||||
closed_at=datetime.now(timezone.utc),
|
||||
closed_at=datetime.now(UTC),
|
||||
closed_by_type=ParticipantType.ADMIN,
|
||||
closed_by_id=test_admin.id,
|
||||
)
|
||||
|
||||
17
tests/fixtures/module_fixtures.py
vendored
17
tests/fixtures/module_fixtures.py
vendored
@@ -7,12 +7,11 @@ and access control.
|
||||
"""
|
||||
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
from datetime import UTC, datetime
|
||||
|
||||
import pytest
|
||||
|
||||
from app.modules.tenancy.models import Platform
|
||||
from app.modules.tenancy.models import PlatformModule
|
||||
from app.modules.tenancy.models import Platform, PlatformModule
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -39,7 +38,7 @@ def platform_with_modules(db, test_super_admin):
|
||||
platform_id=platform.id,
|
||||
module_code=module_code,
|
||||
is_enabled=True,
|
||||
enabled_at=datetime.now(timezone.utc),
|
||||
enabled_at=datetime.now(UTC),
|
||||
enabled_by_user_id=test_super_admin.id,
|
||||
config={},
|
||||
)
|
||||
@@ -50,7 +49,7 @@ def platform_with_modules(db, test_super_admin):
|
||||
platform_id=platform.id,
|
||||
module_code="marketplace",
|
||||
is_enabled=False,
|
||||
disabled_at=datetime.now(timezone.utc),
|
||||
disabled_at=datetime.now(UTC),
|
||||
disabled_by_user_id=test_super_admin.id,
|
||||
config={},
|
||||
)
|
||||
@@ -83,7 +82,7 @@ def platform_with_config(db, test_super_admin):
|
||||
platform_id=platform.id,
|
||||
module_code="billing",
|
||||
is_enabled=True,
|
||||
enabled_at=datetime.now(timezone.utc),
|
||||
enabled_at=datetime.now(UTC),
|
||||
enabled_by_user_id=test_super_admin.id,
|
||||
config={
|
||||
"stripe_mode": "test",
|
||||
@@ -98,7 +97,7 @@ def platform_with_config(db, test_super_admin):
|
||||
platform_id=platform.id,
|
||||
module_code="inventory",
|
||||
is_enabled=True,
|
||||
enabled_at=datetime.now(timezone.utc),
|
||||
enabled_at=datetime.now(UTC),
|
||||
enabled_by_user_id=test_super_admin.id,
|
||||
config={
|
||||
"low_stock_threshold": 5,
|
||||
@@ -146,9 +145,9 @@ def module_factory(db, test_super_admin):
|
||||
platform_id=platform_id,
|
||||
module_code=module_code,
|
||||
is_enabled=is_enabled,
|
||||
enabled_at=datetime.now(timezone.utc) if is_enabled else None,
|
||||
enabled_at=datetime.now(UTC) if is_enabled else None,
|
||||
enabled_by_user_id=test_super_admin.id if is_enabled else None,
|
||||
disabled_at=None if is_enabled else datetime.now(timezone.utc),
|
||||
disabled_at=None if is_enabled else datetime.now(UTC),
|
||||
disabled_by_user_id=None if is_enabled else test_super_admin.id,
|
||||
config=config or {},
|
||||
)
|
||||
|
||||
5
tests/fixtures/store_fixtures.py
vendored
5
tests/fixtures/store_fixtures.py
vendored
@@ -10,10 +10,9 @@ import uuid
|
||||
|
||||
import pytest
|
||||
|
||||
from app.modules.tenancy.models import Merchant
|
||||
from app.modules.inventory.models import Inventory
|
||||
from app.modules.catalog.models import Product
|
||||
from app.modules.tenancy.models import Store
|
||||
from app.modules.inventory.models import Inventory
|
||||
from app.modules.tenancy.models import Merchant, Store
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in New Issue
Block a user