-
Notifications
You must be signed in to change notification settings - Fork 13
/
.pre-commit-config.yaml
76 lines (76 loc) · 3.09 KB
/
.pre-commit-config.yaml
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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude_types: ['markdown']
- id: end-of-file-fixer
exclude_types: ['jupyter']
- id: check-yaml
args: ["--unsafe"]
exclude: 'kubernetes/apps/charts/.*'
- id: check-added-large-files
# TODO: could we use ruff to replace flake8/isort and maybe black?
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: ["--ignore=E501,W503"] # line too long and line before binary operator (black is ok with these)
types:
- python
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
args: ["--config=./pyproject.toml"]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/pycqa/bandit
rev: 1.7.5
hooks:
- id: bandit
args: ["-ll", "--skip=B108,B608,B310,B303,B324,B113"]
files: .py$
- repo: https://github.com/sqlfluff/sqlfluff
rev: 3.0.6
hooks:
- id: sqlfluff-lint
additional_dependencies: ['dbt-bigquery==1.8.1', 'sqlfluff-templater-dbt']
# skip: L003 indentation stuff -- TODO
# skip: L010 uppercase keywords -- TODO
# skip: L011 implicit/explicit aliasing of tables? -- TODO
# skip: L022 spacing between CTEs -- TODO
# skip: L036 select targets should be on new line unless only 1 target
# skip: L038 trailing comma in SELECT, bigquery is OK with this
# skip: L039 unnecessary whitespace, this is tricky with templating
# skip: L059 unnecessary quoted identifier, we need this for `extract` among others
# skip: parsing, templating that are unfixable by linter
# skip: line too long, keywords should not be used as identifier (at least for now...)
# skip: unqualified reference from multiple tables
# skip: found using expected only on
# skip: column order -- messed up union operation
# skip: joins should not include subqueries -- TODO
# skip: use left join instead of right join -- TODO
# skip: use single quotes instead of double -- TODO
# args: [-vvv, --dialect, "bigquery", --ignore, "parsing,templating",--exclude-rules, "L003,L010,L011,L022,L036,L038,L039,L059,L016,L029,L027,L032,L034,L014,L042,L055,L064"]
# files: "warehouse/models" # TODO: should also lint tests etc. but we want to skip packages at least
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
# list of exclusions: https://stackoverflow.com/a/75560858
# mdformat does not play nice with GitHub callouts: https://github.com/orgs/community/discussions/16925
# so skip README files that use them
exclude: 'README.md|warehouse/.*'
args: ["--number"]
additional_dependencies:
- mdformat-gfm
- mdformat-frontmatter
- mdformat-footnote