.pre-commit-config.yaml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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/
  21. - id: end-of-file-fixer
  22. exclude: ^static/
  23. - id: check-yaml
  24. - id: check-json
  25. exclude: ^(static/|frontend/tsconfig\.)
  26. - id: check-added-large-files
  27. args: ['--maxkb=1000']
  28. exclude: ^static/assets/
  29. - id: check-merge-conflict
  30. - id: debug-statements
  31. - id: detect-private-key
  32. # Check for import shadowing (custom)
  33. - repo: local
  34. hooks:
  35. - id: check-import-shadowing
  36. name: Check for dangerous import shadowing
  37. entry: python -m pytest backend/tests/unit/test_code_quality.py::TestImportShadowing -v --tb=short
  38. language: system
  39. pass_filenames: false
  40. types: [python]
  41. files: ^backend/app/
  42. - id: frontend-typecheck
  43. name: TypeScript type check
  44. entry: bash -c 'cd frontend && npx tsc --noEmit'
  45. language: system
  46. pass_filenames: false
  47. files: ^frontend/src/
  48. types_or: [ts, tsx]