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

@@ -4,7 +4,6 @@ RESTful API for architecture validation and violation management
"""
from datetime import datetime
from typing import Optional
from fastapi import APIRouter, Depends, HTTPException, Query
from pydantic import BaseModel, Field
@@ -32,7 +31,7 @@ class ScanResponse(BaseModel):
warnings: int
duration_seconds: float
triggered_by: str
git_commit_hash: Optional[str]
git_commit_hash: str | None
class Config:
from_attributes = True
@@ -49,13 +48,13 @@ class ViolationResponse(BaseModel):
file_path: str
line_number: int
message: str
context: Optional[str]
suggestion: Optional[str]
context: str | None
suggestion: str | None
status: str
assigned_to: Optional[int]
resolved_at: Optional[str]
resolved_by: Optional[int]
resolution_note: Optional[str]
assigned_to: int | None
resolved_at: str | None
resolved_by: int | None
resolution_note: str | None
created_at: str
class Config:
@@ -83,7 +82,7 @@ class AssignViolationRequest(BaseModel):
"""Request model for assigning a violation"""
user_id: int = Field(..., description="User ID to assign to")
due_date: Optional[datetime] = Field(None, description="Due date for resolution")
due_date: datetime | None = Field(None, description="Due date for resolution")
priority: str = Field(
"medium", description="Priority level (low, medium, high, critical)"
)
@@ -123,7 +122,7 @@ class DashboardStatsResponse(BaseModel):
by_rule: dict
by_module: dict
top_files: list
last_scan: Optional[str]
last_scan: str | None
# API Endpoints
@@ -189,17 +188,17 @@ async def list_scans(
@router.get("/violations", response_model=ViolationListResponse)
async def list_violations(
scan_id: Optional[int] = Query(
scan_id: int | None = Query(
None, description="Filter by scan ID (defaults to latest)"
),
severity: Optional[str] = Query(
severity: str | None = Query(
None, description="Filter by severity (error, warning)"
),
status: Optional[str] = Query(
status: str | None = Query(
None, description="Filter by status (open, assigned, resolved, ignored)"
),
rule_id: Optional[str] = Query(None, description="Filter by rule ID"),
file_path: Optional[str] = Query(
rule_id: str | None = Query(None, description="Filter by rule ID"),
file_path: str | None = Query(
None, description="Filter by file path (partial match)"
),
page: int = Query(1, ge=1, description="Page number"),