.pre-commit-config.yaml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # To use:
  2. #
  3. # pre-commit run -a
  4. #
  5. # Or:
  6. #
  7. # pre-commit install # (runs every time you commit in git)
  8. #
  9. # To update this file:
  10. #
  11. # pre-commit autoupdate
  12. #
  13. # See https://github.com/pre-commit/pre-commit
  14. repos:
  15. # Standard hooks
  16. - repo: https://github.com/pre-commit/pre-commit-hooks
  17. rev: v3.4.0
  18. hooks:
  19. - id: check-added-large-files
  20. - id: check-case-conflict
  21. - id: check-merge-conflict
  22. - id: check-symlinks
  23. - id: check-yaml
  24. - id: debug-statements
  25. - id: end-of-file-fixer
  26. - id: mixed-line-ending
  27. - id: requirements-txt-fixer
  28. - id: trailing-whitespace
  29. - id: fix-encoding-pragma
  30. # Black, the code formatter, natively supports pre-commit
  31. - repo: https://github.com/psf/black
  32. rev: 20.8b1
  33. hooks:
  34. - id: black
  35. # By default, this ignores pyi files, though black supports them
  36. types: [text]
  37. files: \.pyi?$
  38. # Changes tabs to spaces
  39. - repo: https://github.com/Lucas-C/pre-commit-hooks
  40. rev: v1.1.9
  41. hooks:
  42. - id: remove-tabs
  43. # Flake8 also supports pre-commit natively (same author)
  44. - repo: https://gitlab.com/pycqa/flake8
  45. rev: 3.8.4
  46. hooks:
  47. - id: flake8
  48. additional_dependencies: [flake8-bugbear, pep8-naming]
  49. exclude: ^(docs/.*|tools/.*)$
  50. # CMake formatting
  51. - repo: https://github.com/cheshirekow/cmake-format-precommit
  52. rev: v0.6.13
  53. hooks:
  54. - id: cmake-format
  55. additional_dependencies: [pyyaml]
  56. types: [file]
  57. files: (\.cmake|CMakeLists.txt)(.in)?$
  58. # Check static types with mypy
  59. - repo: https://github.com/pre-commit/mirrors-mypy
  60. rev: v0.800
  61. hooks:
  62. - id: mypy
  63. # The default Python type ignores .pyi files, so let's rerun if detected
  64. types: [text]
  65. files: ^pybind11.*\.pyi?$
  66. # Running per-file misbehaves a bit, so just run on all files, it's fast
  67. pass_filenames: false
  68. # Checks the manifest for missing files (native support)
  69. - repo: https://github.com/mgedmin/check-manifest
  70. rev: "0.46"
  71. hooks:
  72. - id: check-manifest
  73. # This is a slow hook, so only run this if --hook-stage manual is passed
  74. stages: [manual]
  75. additional_dependencies: [cmake, ninja]
  76. # The original pybind11 checks for a few C++ style items
  77. - repo: local
  78. hooks:
  79. - id: disallow-caps
  80. name: Disallow improper capitalization
  81. language: pygrep
  82. entry: PyBind|Numpy|Cmake|CCache
  83. exclude: .pre-commit-config.yaml
  84. - repo: local
  85. hooks:
  86. - id: check-style
  87. name: Classic check-style
  88. language: system
  89. types:
  90. - c++
  91. entry: ./tools/check-style.sh