.pre-commit-config.yaml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Pre-commit hooks for BamBuddy
  2. # Install with: pip install pre-commit && pre-commit install
  3. repos:
  4. # Ruff - Fast Python linter and formatter
  5. - repo: https://github.com/astral-sh/ruff-pre-commit
  6. rev: v0.14.11
  7. hooks:
  8. # Linter
  9. - id: ruff
  10. args: [--fix, --exit-non-zero-on-fix]
  11. types_or: [python, pyi]
  12. # Formatter
  13. - id: ruff-format
  14. types_or: [python, pyi]
  15. # Standard pre-commit hooks
  16. - repo: https://github.com/pre-commit/pre-commit-hooks
  17. rev: v5.0.0
  18. hooks:
  19. - id: trailing-whitespace
  20. # Exclude static/ (build output) and gcode_viewer/ (vendored third-party
  21. # assets — see gcode_viewer/VENDORED.md) so whitespace normalisation
  22. # doesn't drift the files away from upstream.
  23. exclude: ^(static/|gcode_viewer/)
  24. - id: end-of-file-fixer
  25. exclude: ^(static/|gcode_viewer/)
  26. - id: check-yaml
  27. - id: check-json
  28. exclude: ^(static/|frontend/tsconfig\.)
  29. - id: check-added-large-files
  30. args: ['--maxkb=1000']
  31. exclude: ^static/assets/
  32. - id: check-merge-conflict
  33. - id: debug-statements
  34. - id: detect-private-key
  35. # Check for import shadowing (custom)
  36. - repo: local
  37. hooks:
  38. - id: check-import-shadowing
  39. name: Check for dangerous import shadowing
  40. entry: python -m pytest backend/tests/unit/test_code_quality.py::TestImportShadowing -v --tb=short
  41. language: system
  42. pass_filenames: false
  43. types: [python]
  44. files: ^backend/app/
  45. - id: frontend-typecheck
  46. name: TypeScript type check
  47. entry: bash -c 'cd frontend && npx tsc --noEmit'
  48. language: system
  49. pass_filenames: false
  50. files: ^frontend/src/
  51. types_or: [ts, tsx]