maziggy
|
c317ff1085
|
1. Pre-commit Hook Configuration (.pre-commit-config.yaml)
- Ruff linter and formatter - Fast Python linter with auto-fix
- Standard hooks - trailing whitespace, end-of-file, YAML/JSON checks, large file detection, merge conflict detection, debug statements, private key detection
- Custom hook - Runs import shadowing tests before commit
2. Ruff Configuration (pyproject.toml)
- Python 3.11+ target
- 120 character line length
- Checks: pycodestyle, Pyflakes, isort, flake8-bugbear, comprehensions, pyupgrade, unused arguments, simplify
- Sensible ignores for FastAPI patterns (Depends, unused route args)
3. New Test Files
backend/tests/unit/test_code_quality.py (5 tests)
- Import shadowing detection using AST analysis
- Catches the exact bug that broke archive creation
- Tests all Python files in main, services, and routes
backend/tests/unit/test_log_error_detection.py (13 tests)
- MQTT message processing (status, xcam, AMS, HMS)
- Print lifecycle (start to complete, failure handling)
- Service imports verification
- Edge cases (empty messages, unknown fields, null values)
backend/tests/integration/test_print_lifecycle.py (6 tests)
- Print start callback logic
- Print complete callback logic
- Timelapse tracking (same-message detection, completion callback)
- Callback error handling
- Import shadowing verification
|
2025-12-13 09:57:04 +01:00 |
|