.pre-commit-config.yaml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. repos:
  2. - repo: https://github.com/pre-commit/pre-commit-hooks
  3. rev: v4.6.0
  4. hooks:
  5. - id: check-added-large-files
  6. args: ['--maxkb=512']
  7. - id: check-case-conflict
  8. - id: check-merge-conflict
  9. - id: check-symlinks
  10. - id: detect-private-key
  11. - id: end-of-file-fixer
  12. - id: trailing-whitespace
  13. files: \.(md|c|cc|cxx|cpp|cu|h|hpp|hxx|py)$
  14. - repo: https://github.com/Lucas-C/pre-commit-hooks
  15. rev: v1.5.1
  16. hooks:
  17. - id: remove-crlf
  18. - id: remove-tabs
  19. files: \.(md|c|cc|cxx|cpp|cu|h|hpp|hxx|py)$
  20. - repo: local
  21. hooks:
  22. - id: clang-format
  23. name: clang-format
  24. description: Format files with ClangFormat
  25. entry: bash .precommit/clang_format.hook -i
  26. language: system
  27. files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
  28. # For Python files
  29. - repo: https://github.com/psf/black.git
  30. rev: 24.4.2
  31. hooks:
  32. - id: black
  33. files: (.*\.(py|pyi|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
  34. # Flake8
  35. - repo: https://github.com/pycqa/flake8
  36. rev: 7.0.0
  37. hooks:
  38. - id: flake8
  39. args:
  40. - --count
  41. - --select=E9,F63,F7,F82,E721,F401
  42. - --per-file-ignores=__init__.py:F401
  43. - --show-source
  44. - --statistics
  45. # isort
  46. - repo: https://github.com/pycqa/isort
  47. rev: 5.12.0
  48. hooks:
  49. - id: isort
  50. args:
  51. - --profile=black
  52. exclude: ^libs/ultra-infer/python/ultra_infer/
  53. # check license
  54. - repo: local
  55. hooks:
  56. - id: check-license-headers
  57. name: Check License Headers
  58. entry: python .precommit/check_license_headers.py
  59. language: python
  60. files: .*\.py$
  61. - id: check-imports
  62. name: Check Imports
  63. entry: python .precommit/check_imports.py
  64. language: python
  65. files: ^paddlex/.*\.py$
  66. additional_dependencies:
  67. - stdlib-list==0.10.0