.pre-commit-config.yaml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. exclude: |
  13. (?x)^(
  14. deploy/hps/server_env/requirements/.*\.txt
  15. )$
  16. - id: trailing-whitespace
  17. files: \.(md|c|cc|cxx|cpp|cu|h|hpp|hxx|py)$
  18. - repo: https://github.com/Lucas-C/pre-commit-hooks
  19. rev: v1.5.1
  20. hooks:
  21. - id: remove-crlf
  22. - id: remove-tabs
  23. files: \.(md|c|cc|cxx|cpp|cu|h|hpp|hxx|py)$
  24. - repo: local
  25. hooks:
  26. - id: clang-format
  27. name: clang-format
  28. description: Format files with ClangFormat
  29. entry: bash .precommit/clang_format.hook -i
  30. language: system
  31. files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
  32. # For Python files
  33. - repo: https://github.com/psf/black.git
  34. rev: 24.4.2
  35. hooks:
  36. - id: black
  37. files: (.*\.(py|pyi|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
  38. # Flake8
  39. - repo: https://github.com/pycqa/flake8
  40. rev: 7.0.0
  41. hooks:
  42. - id: flake8
  43. args:
  44. - --count
  45. - --select=E9,F63,F7,F82,E721,F401
  46. - --per-file-ignores=__init__.py:F401
  47. - --show-source
  48. - --statistics
  49. # isort
  50. - repo: https://github.com/pycqa/isort
  51. rev: 5.12.0
  52. hooks:
  53. - id: isort
  54. args:
  55. - --profile=black
  56. exclude: ^deploy/ultra-infer/python/ultra_infer/
  57. # check license
  58. - repo: local
  59. hooks:
  60. - id: check-license-headers
  61. name: Check License Headers
  62. entry: python .precommit/check_license_headers.py
  63. language: python
  64. files: .*\.py$
  65. - id: check-imports
  66. name: Check Imports
  67. entry: python .precommit/check_imports.py
  68. language: python
  69. files: ^paddlex/.*\.py$
  70. additional_dependencies:
  71. - stdlib-list==0.10.0