.pre-commit-config.yaml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. exclude: >
  2. (?x)(
  3. LICENSE$|
  4. \.snap$|
  5. \.map$|
  6. \.map\.js$|
  7. ^src/sentry/static/sentry/vendor/|
  8. ^src/.*/locale/|
  9. ^src/sentry/data/
  10. )
  11. repos:
  12. # Many of these hooks are local because people use a variety of IDEs
  13. # with autoformatters that need to call out to things like `black` directly.
  14. # pre-commit run is not the same, and something like pre-commit exec does
  15. # not exist yet.
  16. - repo: local
  17. hooks:
  18. - id: pyupgrade
  19. name: pyupgrade
  20. entry: pyupgrade
  21. args: ['--py38-plus', '--keep-runtime-typing']
  22. language: system
  23. types: [python]
  24. # Configuration for black exists in pyproject.toml,
  25. # but we let pre-commit take care of the file filtering.
  26. - id: black
  27. name: black
  28. entry: black
  29. language: system
  30. types: [python]
  31. require_serial: true
  32. # Configuration for isort exists in pyproject.toml,
  33. # but we let pre-commit take care of the file filtering.
  34. - id: isort
  35. name: isort
  36. entry: isort
  37. language: system
  38. types: [python]
  39. # Configuration for flake8 exists in setup.cfg,
  40. # but we let pre-commit take care of the file filtering.
  41. - id: flake8
  42. name: flake8
  43. entry: flake8
  44. language: system
  45. types: [python]
  46. log_file: '.artifacts/flake8.pycodestyle.log'
  47. - id: lint-requirements
  48. name: lint-requirements
  49. entry: python -m tools.lint_requirements
  50. language: python
  51. files: requirements-.*\.txt$
  52. additional_dependencies: [packaging==21.3]
  53. - id: pyright
  54. name: pyright
  55. entry: pyright
  56. language: node
  57. files: ^src/
  58. types: [ python ]
  59. require_serial: true
  60. additional_dependencies: [ "pyright@1.1.186" ]
  61. args: [ '--project', 'pyrightconfig-commithook.json' ]
  62. - id: prevent-push
  63. name: prevent pushing master
  64. stages: [push]
  65. entry: bash -c 'test "$PRE_COMMIT_REMOTE_BRANCH" != "refs/heads/master"'
  66. always_run: true
  67. pass_filenames: false
  68. language: system
  69. - repo: https://github.com/python-jsonschema/check-jsonschema
  70. rev: 0.21.0
  71. hooks:
  72. - id: check-github-actions
  73. - id: check-github-workflows
  74. args: [--verbose]
  75. - repo: https://github.com/pre-commit/pre-commit-hooks
  76. rev: v4.3.0
  77. hooks:
  78. - id: check-case-conflict
  79. - id: check-executables-have-shebangs
  80. - id: check-merge-conflict
  81. - id: check-symlinks
  82. - id: check-yaml
  83. - id: end-of-file-fixer
  84. exclude_types: [svg]
  85. exclude: ^fixtures/
  86. - id: trailing-whitespace
  87. exclude_types: [svg]
  88. exclude: ^(fixtures/|scripts/patches/)
  89. - id: debug-statements
  90. - id: name-tests-test
  91. args: [--pytest-test-first]