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:
@@ -15,16 +15,15 @@ import argparse
|
||||
import random
|
||||
import string
|
||||
import sys
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from pathlib import Path
|
||||
|
||||
# Add project root to path
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
from app.core.database import SessionLocal
|
||||
from app.utils.money import cents_to_euros, euros_to_cents
|
||||
from app.modules.orders.models import Order, OrderItem
|
||||
from app.modules.catalog.models import Product
|
||||
from app.modules.orders.models import Order, OrderItem
|
||||
from app.modules.tenancy.models import Store
|
||||
|
||||
|
||||
@@ -41,7 +40,7 @@ def generate_shipment_number():
|
||||
def generate_hash_id():
|
||||
"""Generate a realistic hash ID like nvDv5RQEmCwbjo."""
|
||||
chars = string.ascii_letters + string.digits
|
||||
return ''.join(random.choice(chars) for _ in range(14))
|
||||
return "".join(random.choice(chars) for _ in range(14))
|
||||
|
||||
|
||||
def create_dummy_order(
|
||||
@@ -97,7 +96,7 @@ def create_dummy_order(
|
||||
order_number = generate_order_number()
|
||||
shipment_number = generate_shipment_number()
|
||||
hash_id = generate_hash_id()
|
||||
order_date = datetime.now(timezone.utc) - timedelta(days=random.randint(0, 7))
|
||||
order_date = datetime.now(UTC) - timedelta(days=random.randint(0, 7))
|
||||
|
||||
# Customer data
|
||||
first_names = ["Jean", "Marie", "Pierre", "Sophie", "Michel", "Anne", "Thomas", "Claire"]
|
||||
@@ -180,7 +179,7 @@ def create_dummy_order(
|
||||
db.flush()
|
||||
|
||||
# Create order items with prices in cents
|
||||
for i, product in enumerate(products[:items_count]):
|
||||
for _i, product in enumerate(products[:items_count]):
|
||||
quantity = random.randint(1, 3)
|
||||
unit_price_cents = product.price_cents or 0
|
||||
product_name = product.get_title("en") or f"Product {product.id}"
|
||||
|
||||
Reference in New Issue
Block a user