-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
153 lines (139 loc) · 4.55 KB
/
.pre-commit-config.yaml
File metadata and controls
153 lines (139 loc) · 4.55 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: local
hooks:
- id: get-updated-api-schema
name: get-updated-api-schema
entry: frontend/scripts/generate-ts-types.sh dev
language: script
types: [text]
pass_filenames: false
always_run: true
verbose: true
files: ^backend/
- id: sql-format-and-align
name: sql-format-and-align
entry: backend/scripts/sql-format.sh
language: script
types: [text]
pass_filenames: false
always_run: true
verbose: true
files: ^backend/
exclude: ^(backend/app/db/gen/)
- id: sqlc-gen
name: sqlc-gen
entry: backend/scripts/generate-sqlc.sh
language: script
types: [text]
pass_filenames: false
always_run: true
verbose: true
files: ^backend/
# - id: client-gen
# name: client-gen
# entry: backend/scripts/generate-client.sh
# language: script
# types: [text]
# pass_filenames: false
# always_run: true
# verbose: true
# files: ^backend/
# - id: get-updated-models
# name: get-updated-models
# entry: backend/scripts/generate-postgrest.sh
# language: script
# types: [text]
# pass_filenames: false
# always_run: true
# verbose: true
# - id: sql-format
# files: ^backend/
# name: sql-format
# entry: bash -c 'cd backend/app/db/repositories/queries && sqlfluff fix --force . --dialect postgres'
# language: system
# types: [text]
# pass_filenames: false
# FIXME possible culprit of random change in lines triggers new docker build, quite annoying
# e.g. black==22.1 --> black==22.1.0 and cache is invalidated
# - repo: https://github.com/jazzband/pip-tools
# rev: 6.5.1
# hooks:
# # order matters, dev-deps depends on regular deps
# - id: pip-compile
# entry: bash -c 'cd backend && source .venv/bin/activate && pip-compile requirements.in'
# language: system
# types: [text]
# name: pip-compile requirements.in
# files: ^backend/requirements.in$
# - id: pip-compile
# entry: bash -c 'cd backend && source .venv/bin/activate && pip-compile requirements-dev.in'
# language: system
# types: [text]
# name: pip-compile requirements-dev.in
# files: ^backend/requirements-dev.in$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
exclude: ^(backend/app/db/gen/)
- id: end-of-file-fixer
exclude: ^(backend/app/db/gen/)
- id: check-yaml
# - id: check-added-large-files
# args: ["--maxkb=2000"]
# - id: no-commit-to-branch
# args: ["--branch", "master", "--branch", "main"]
- repo: https://github.com/PyCQA/autoflake
# check version in pipfile lock
rev: v1.4
hooks:
- id: autoflake
args: ["--in-place", "--recursive", "--remove-all-unused-imports"]
exclude: ^(backend/app/db/gen/)
- repo: https://github.com/pre-commit/mirrors-mypy
# check version in pipfile lock
rev: v0.942
hooks:
- id: mypy
files: ^backend/ # only check py files in backend
additional_dependencies: [pydantic] # add if use pydantic
exclude: ^(backend/app/db/gen/)
- repo: https://github.com/psf/black
# check version in pipfile lock
rev: 22.1.0
hooks:
- id: black
args: [--config=backend/pyproject.toml] # it's nested, not being picked up otherwise
exclude: ^(backend/app/db/gen/)
- repo: https://github.com/PyCQA/isort
# check version in pipfile lock
rev: 5.9.3
hooks:
- id: isort
exclude: ^(backend/app/db/gen/)
# run after black
- repo: https://gitlab.com/pycqa/flake8
# check version in pipfile lock
rev: 3.9.2
hooks:
- id: flake8
args: ["--config=backend/tox.ini"]
exclude: ^(backend/app/db/gen/)
- repo: local
hooks:
- id: run-eslint-frontend
files: ^frontend/
name: run-eslint-frontend
entry: bash -c 'cd frontend && yarn lint'
language: system
types: [text]
pass_filenames: false
- id: run-tsc-frontend
name: run-tsc-frontend
entry: frontend/scripts/tsc-compilation-check.sh
language: script
types: [text]
pass_filenames: false
always_run: true