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

@@ -15,7 +15,6 @@ import subprocess
import sys
from datetime import datetime
from pathlib import Path
from typing import Dict, List
def count_files(directory: str, pattern: str) -> int:
@@ -38,7 +37,7 @@ def count_files(directory: str, pattern: str) -> int:
return count
def get_tree_structure(directory: str, exclude_patterns: List[str] = None) -> str:
def get_tree_structure(directory: str, exclude_patterns: list[str] = None) -> str:
"""Generate tree structure for directory."""
if not os.path.exists(directory):
return f"Directory {directory} not found"
@@ -55,19 +54,18 @@ def get_tree_structure(directory: str, exclude_patterns: List[str] = None) -> st
errors="replace",
)
return result.stdout
else:
# Linux/Mac tree command with exclusions
exclude_args = []
if exclude_patterns:
exclude_args = ["-I", "|".join(exclude_patterns)]
# Linux/Mac tree command with exclusions
exclude_args = []
if exclude_patterns:
exclude_args = ["-I", "|".join(exclude_patterns)]
result = subprocess.run(
["tree", "-F", "-a"] + exclude_args + [directory],
capture_output=True,
text=True,
)
if result.returncode == 0:
return result.stdout
result = subprocess.run(
["tree", "-F", "-a"] + exclude_args + [directory],
capture_output=True,
text=True,
)
if result.returncode == 0:
return result.stdout
except (subprocess.SubprocessError, FileNotFoundError):
pass
@@ -76,7 +74,7 @@ def get_tree_structure(directory: str, exclude_patterns: List[str] = None) -> st
def generate_manual_tree(
directory: str, exclude_patterns: List[str] = None, prefix: str = ""
directory: str, exclude_patterns: list[str] = None, prefix: str = ""
) -> str:
"""Generate tree structure manually when tree command is not available."""
if exclude_patterns is None:
@@ -567,7 +565,7 @@ def generate_test_structure() -> str:
if file.startswith("test_") and file.endswith(".py"):
filepath = os.path.join(root, file)
try:
with open(filepath, "r", encoding="utf-8") as f:
with open(filepath, encoding="utf-8") as f:
for line in f:
if line.strip().startswith("def test_"):
test_function_count += 1