Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
128 lines (118 loc) · 3.93 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
128 lines (118 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
default_install_hook_types: ["pre-commit", "pre-push"]
default_stages: [pre-commit]
exclude: >
(?x)(
LICENSE.md$|
\.snap$|
\.map$|
\.map\.js$|
^src/sentry/static/sentry/vendor/|
^src/.*/locale/|
^src/sentry/data/
)
repos:
# Many of these hooks are local because people use a variety of IDEs
# with autoformatters that need to call out to things like `ruff` directly.
# pre-commit run is not the same, and something like pre-commit exec does
# not exist yet.
- repo: local
hooks:
- id: pyupgrade
name: pyupgrade
entry: pyupgrade
args: ["--py313-plus"]
language: system
types: [python]
# Configuration for ruff exists in pyproject.toml,
# but we let pre-commit take care of the file filtering.
- id: ruff-format
name: ruff format
entry: ruff format
language: system
types_or: [python, pyi]
require_serial: true
- id: ruff-check
name: ruff check
entry: ruff check --fix
language: system
types_or: [python, pyi]
require_serial: true
- id: mypy
name: mypy
entry: mypy src
language: system
types: [python]
require_serial: true
pass_filenames: false
- id: check-mypy-bypass
name: do not bypass the type checker
entry: '(^# *mypy: *ignore-errors|^# *type: *ignore|\bno_type_check\b|ignore\[import-untyped\])'
language: pygrep
types: [python]
- id: prevent-push
name: prevent pushing master
stages: [pre-push]
entry: bash -c 'test "$PRE_COMMIT_REMOTE_BRANCH" != "refs/heads/master"'
always_run: true
pass_filenames: false
language: system
# Javascript linting, formatting.
# We're using the local node_modules to simplify things, otherwise would
# need an easy way to keep versions in sync. Furthermore some repositories
# are either not on pre-commit mirrors or are missing some tagged versions.
# pre-commit-managed nodeenv environments also do not work out of the box because
# additional_dependencies does not install a flattened dependency tree which is needed by,
# for example, our eslint setup.
- id: eslint
name: eslint
language: system
files: \.(ts|js|tsx|jsx|mjs)$
entry: bash -c 'cd frontend && pnpm run lint:fix --quiet'
- id: prettier
name: prettier
language: system
files: ^frontend/.*\.(ts|tsx|js|jsx|css|json|md|yaml|yml)$
entry: bash -c 'cd frontend && pnpm run format'
pass_filenames: false
- id: knip
name: knip
language: system
files: \.(ts|js|tsx|jsx|mjs)$
pass_filenames: false
stages: [pre-push]
entry: bash -c 'if [ -n "${SENTRY_KNIP_PRE_PUSH:-}" ]; then exec ./node_modules/.bin/knip; fi' --
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-use-type-annotations
- id: python-check-blanket-type-ignore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.3
hooks:
- id: check-github-actions
- id: check-github-workflows
args: [--verbose]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: end-of-file-fixer
exclude_types: [svg]
exclude: ^fixtures/
- id: trailing-whitespace
exclude_types: [svg]
exclude: ^(fixtures/|scripts/patches/)
- id: debug-statements
- id: name-tests-test
args: [--pytest-test-first]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
types: [file]
files: ^\.envrc$
args: [--external-sources]