.pre-commit-config.yaml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. exclude: >
  2. (?x)(
  3. LICENSE$|
  4. \.snap$|
  5. \.map$|
  6. \.map\.js$|
  7. ^tests/sentry/lang/.*/fixtures/|
  8. ^tests/fixtures/|
  9. ^src/sentry/static/sentry/vendor/|
  10. ^tests/sentry/lang/javascript/example-project/|
  11. ^src/.*/locale/|
  12. ^src/sentry/data/
  13. )
  14. repos:
  15. # For some tools, we install them locally (in the virtualenv).
  16. # This makes it easier to use them directly (as opposed to pre-commit run),
  17. # and it's also faster as pre-commit doesn't have to manage them.
  18. # The thing we lose here is autoupdate, but we have git hooks that
  19. # let you know when requirements-pre-commit.txt changes.
  20. - repo: local
  21. hooks:
  22. - id: pyupgrade
  23. name: pyupgrade
  24. entry: pyupgrade
  25. args: ['--py38-plus', '--keep-runtime-typing']
  26. language: system
  27. types: [python]
  28. # We can't change this mock to unittest.mock until Python 3.8,
  29. # refer to the comment in this file.
  30. exclude: 'src/sentry/utils/compat/mock.py'
  31. # Configuration for black exists in pyproject.toml,
  32. # but we let pre-commit take care of the file filtering.
  33. - id: black
  34. name: black
  35. entry: black
  36. language: system
  37. types: [python]
  38. # Configuration for isort exists in pyproject.toml,
  39. # but we let pre-commit take care of the file filtering.
  40. - id: isort
  41. name: isort
  42. entry: isort
  43. language: system
  44. types: [python]
  45. # Configuration for flake8 exists in setup.cfg,
  46. # but we let pre-commit take care of the file filtering.
  47. - id: flake8
  48. name: flake8
  49. entry: flake8
  50. language: system
  51. types: [python]
  52. log_file: '.artifacts/flake8.pycodestyle.log'
  53. - id: lint-requirements
  54. name: lint-requirements
  55. entry: bin/lint-requirements
  56. language: system
  57. files: requirements-base.txt
  58. pass_filenames: false
  59. - id: pyright
  60. name: pyright
  61. entry: pyright
  62. language: node
  63. types: [ python ]
  64. pass_filenames: true
  65. additional_dependencies: [ "pyright@1.1.186" ]
  66. args: [ '--project', 'pyrightconfig-commithook.json' ]
  67. - repo: https://github.com/sirosen/check-jsonschema
  68. rev: 0.3.0
  69. hooks:
  70. - id: check-github-actions
  71. - id: check-github-workflows
  72. - repo: https://github.com/pre-commit/pre-commit-hooks
  73. rev: v4.0.1
  74. hooks:
  75. - id: check-case-conflict
  76. - id: check-executables-have-shebangs
  77. - id: check-merge-conflict
  78. - id: check-symlinks
  79. - id: end-of-file-fixer
  80. exclude_types: [svg]
  81. - id: trailing-whitespace
  82. exclude_types: [svg]
  83. - id: debug-statements