.pre-commit-config.yaml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. exclude: '^(tinygrad_repo)'
  2. repos:
  3. - repo: meta
  4. hooks:
  5. - id: check-hooks-apply
  6. - id: check-useless-excludes
  7. - repo: https://github.com/pre-commit/pre-commit-hooks
  8. rev: v4.5.0
  9. hooks:
  10. - id: check-ast
  11. exclude: '^(third_party)/'
  12. - id: check-json
  13. exclude: '.devcontainer/devcontainer.json|.vscode/' # these support JSON with comments
  14. - id: check-toml
  15. - id: check-xml
  16. - id: check-yaml
  17. - id: check-merge-conflict
  18. - id: check-symlinks
  19. - id: check-executables-have-shebangs
  20. - id: check-shebang-scripts-are-executable
  21. - id: check-added-large-files
  22. exclude: '(docs/CARS.md)|(poetry.lock)|(third_party/acados/include/blasfeo/include/blasfeo_d_kernel.h)'
  23. args:
  24. - --maxkb=120
  25. - --enforce-all
  26. - repo: https://github.com/codespell-project/codespell
  27. rev: v2.2.6
  28. hooks:
  29. - id: codespell
  30. exclude: '^(third_party/)|(body/)|(cereal/)|(panda/)|(opendbc/)|(rednose/)|(rednose_repo/)|(teleoprtc/)|(teleoprtc_repo/)|(selfdrive/ui/translations/.*.ts)|(poetry.lock)'
  31. args:
  32. # if you've got a short variable name that's getting flagged, add it here
  33. - -L bu,ro,te,ue,alo,hda,ois,nam,nams,ned,som,parm,setts,inout,warmup,bumb,nd,sie,preints
  34. - --builtins clear,rare,informal,usage,code,names,en-GB_to_en-US
  35. - repo: https://github.com/astral-sh/ruff-pre-commit
  36. rev: v0.2.2
  37. hooks:
  38. - id: ruff
  39. exclude: '^(third_party/)|(cereal/)|(panda/)|(rednose/)|(rednose_repo/)|(tinygrad/)|(tinygrad_repo/)|(teleoprtc/)|(teleoprtc_repo/)'
  40. - repo: local
  41. hooks:
  42. - id: mypy
  43. name: mypy
  44. entry: mypy
  45. language: system
  46. types: [python]
  47. args:
  48. - --local-partial-types
  49. - --explicit-package-bases
  50. exclude: '^(third_party/)|(cereal/)|(opendbc/)|(panda/)|(rednose/)|(rednose_repo/)|(tinygrad/)|(tinygrad_repo/)|(teleoprtc/)|(teleoprtc_repo/)|(xx/)'
  51. - repo: local
  52. hooks:
  53. - id: cppcheck
  54. name: cppcheck
  55. entry: cppcheck
  56. language: system
  57. types: [c++]
  58. exclude: '^(third_party/)|(cereal/)|(body/)|(rednose/)|(rednose_repo/)|(opendbc/)|(panda/)|(tools/)|(selfdrive/modeld/thneed/debug/)|(selfdrive/modeld/test/)|(selfdrive/camerad/test/)|(installer/)'
  59. args:
  60. - --error-exitcode=1
  61. - --language=c++
  62. - --quiet
  63. - --force
  64. - -j8
  65. - repo: https://github.com/cpplint/cpplint
  66. rev: 1.6.1
  67. hooks:
  68. - id: cpplint
  69. exclude: '^(third_party/)|(cereal/)|(body/)|(rednose/)|(rednose_repo/)|(opendbc/)|(panda/)|(generated/)'
  70. args:
  71. - --quiet
  72. - --counting=total
  73. - --linelength=240
  74. # https://google.github.io/styleguide/cppguide.html
  75. # relevant rules are whitelisted, see all options with: cpplint --filter=
  76. - --filter=-build,-legal,-readability,-runtime,-whitespace,+build/include_subdir,+build/forward_decl,+build/include_what_you_use,+build/deprecated,+whitespace/comma,+whitespace/line_length,+whitespace/empty_if_body,+whitespace/empty_loop_body,+whitespace/empty_conditional_body,+whitespace/forcolon,+whitespace/parens,+whitespace/semicolon,+whitespace/tab,+readability/braces
  77. - repo: https://github.com/MarcoGorelli/cython-lint
  78. rev: v0.16.0
  79. hooks:
  80. - id: cython-lint
  81. exclude: '^(third_party/)|(cereal/)|(body/)|(rednose/)|(rednose_repo/)|(opendbc/)|(panda/)|(generated/)'
  82. args:
  83. - --max-line-length=240
  84. - --ignore=E111, E302, E305
  85. - repo: local
  86. hooks:
  87. - id: test_translations
  88. name: test translations
  89. entry: selfdrive/ui/tests/test_translations.py
  90. language: script
  91. pass_filenames: false
  92. files: 'selfdrive/ui/translations/*'
  93. - repo: https://github.com/python-poetry/poetry
  94. rev: '1.8.0'
  95. hooks:
  96. - id: poetry-check
  97. name: validate poetry lock
  98. args:
  99. - --lock
  100. - repo: https://github.com/python-jsonschema/check-jsonschema
  101. rev: 0.28.0
  102. hooks:
  103. - id: check-github-workflows