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

@@ -175,24 +175,24 @@ test-inventory:
# =============================================================================
format:
@echo "Running black..."
$(PYTHON) -m black . --exclude '/(\.)?venv/'
@echo "Running isort..."
$(PYTHON) -m isort . --skip venv --skip .venv
@echo "Formatting code with ruff..."
$(PYTHON) -m ruff format .
lint:
@echo "Running linting..."
$(PYTHON) -m ruff check . --exclude venv --exclude .venv
$(PYTHON) -m mypy . --ignore-missing-imports --exclude '.*(\.)?venv.*'
@echo "Linting code with ruff..."
$(PYTHON) -m ruff check . --fix
@echo "Type checking with mypy..."
$(PYTHON) -m mypy .
lint-flake8:
@echo "Running linting..."
$(PYTHON) -m flake8 . --max-line-length=120 --extend-ignore=E203,W503,I201,I100 --exclude=venv,.venv,__pycache__,.git
$(PYTHON) -m mypy . --ignore-missing-imports --exclude '.*(\.)?venv.*'
lint-strict:
@echo "Linting (no auto-fix)..."
$(PYTHON) -m ruff check .
@echo "Type checking with mypy..."
$(PYTHON) -m mypy .
check: format lint
ci: format lint test-coverage
ci: lint-strict test-coverage
qa: format lint test-coverage docs-check
@echo "Quality assurance checks completed!"
@@ -330,10 +330,11 @@ help:
@echo " test-fast - Run fast tests only"
@echo ""
@echo "=== CODE QUALITY ==="
@echo " format - Format code (black + isort)"
@echo " lint - Run linting (ruff + mypy)"
@echo " format - Format code with ruff"
@echo " lint - Lint and auto-fix with ruff + mypy"
@echo " lint-strict - Lint without auto-fix + mypy"
@echo " check - Format + lint"
@echo " ci - Full CI pipeline"
@echo " ci - Full CI pipeline (strict)"
@echo " qa - Quality assurance"
@echo ""
@echo "=== DOCUMENTATION ==="