refactor: modernize code quality tooling with Ruff

- Replace black, isort, and flake8 with Ruff (all-in-one linter and formatter)
- Add comprehensive pyproject.toml configuration
- Simplify Makefile code quality targets
- Configure exclusions for venv/.venv in pyproject.toml
- Auto-fix 1,359 linting issues across codebase

Benefits:
- Much faster builds (Ruff is written in Rust)
- Single tool replaces multiple tools
- More comprehensive rule set (UP, B, C4, SIM, PIE, RET, Q)
- All configuration centralized in pyproject.toml
- Better import sorting and formatting consistency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-28 19:37:38 +01:00
parent 21c13ca39b
commit 238c1ec9b8
169 changed files with 2183 additions and 1784 deletions

View File

@@ -1,7 +1,7 @@
# Marketplace CSV import tasks
# app/tasks/background_tasks.py
import logging
from datetime import datetime, timezone
from datetime import UTC, datetime
from app.core.database import SessionLocal
from app.utils.csv_processor import CSVProcessor
@@ -40,13 +40,13 @@ async def process_marketplace_import(
logger.error(f"Vendor {vendor_id} not found for import job {job_id}")
job.status = "failed"
job.error_message = f"Vendor {vendor_id} not found"
job.completed_at = datetime.now(timezone.utc)
job.completed_at = datetime.now(UTC)
db.commit()
return
# Update job status
job.status = "processing"
job.started_at = datetime.now(timezone.utc)
job.started_at = datetime.now(UTC)
db.commit()
logger.info(
@@ -65,7 +65,7 @@ async def process_marketplace_import(
# Update job with results
job.status = "completed"
job.completed_at = datetime.now(timezone.utc)
job.completed_at = datetime.now(UTC)
job.imported_count = result["imported"]
job.updated_count = result["updated"]
job.error_count = result.get("errors", 0)
@@ -88,13 +88,13 @@ async def process_marketplace_import(
try:
job.status = "failed"
job.error_message = str(e)
job.completed_at = datetime.now(timezone.utc)
job.completed_at = datetime.now(UTC)
db.commit()
except Exception as commit_error:
logger.error(f"Failed to update job status: {commit_error}")
db.rollback()
finally:
if hasattr(db, "close") and callable(getattr(db, "close")):
if hasattr(db, "close") and callable(db.close):
try:
db.close()
except Exception as close_error: