.pre-commit-config.yaml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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: check-mypy-bypass
  54. name: do not bypass the type checker
  55. entry: '(^# *mypy: *ignore-errors|^# *type: *ignore|\bno_type_check\b)'
  56. language: pygrep
  57. types: [python]
  58. exclude: ^src/sentry/metrics/minimetrics.py$
  59. - repo: https://github.com/pre-commit/pygrep-hooks
  60. rev: v1.10.0
  61. hooks:
  62. - id: python-use-type-annotations
  63. - repo: https://github.com/python-jsonschema/check-jsonschema
  64. rev: 0.24.1
  65. hooks:
  66. - id: check-github-actions
  67. - id: check-github-workflows
  68. args: [--verbose]
  69. - repo: https://github.com/pre-commit/pre-commit-hooks
  70. rev: v4.3.0
  71. hooks:
  72. - id: check-case-conflict
  73. - id: check-executables-have-shebangs
  74. - id: check-merge-conflict
  75. - id: check-symlinks
  76. - id: check-yaml
  77. - id: end-of-file-fixer
  78. exclude_types: [svg]
  79. exclude: ^fixtures/
  80. - id: trailing-whitespace
  81. exclude_types: [svg]
  82. exclude: ^(fixtures/|scripts/patches/)
  83. - id: debug-statements
  84. - id: name-tests-test
  85. args: [--pytest-test-first]