-
Notifications
You must be signed in to change notification settings - Fork 6
/
.pre-commit-config.yaml
205 lines (197 loc) · 6.24 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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: name-tests-test
files: .*test.*\.py$
exclude: /testing/.*\.py$
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.3"
hooks:
- id: prettier
alias: format
name: prettier json/markdown/toml/yaml
exclude: "^client/.*$"
types_or: [json, markdown, toml, yaml]
- repo: https://github.com/psf/black
rev: "22.10.0"
hooks:
- id: black
alias: format
name: "[signal-service] Pyformat"
files: ^signal-service/.*$
- id: black
alias: format
name: "[ui-service] Pyformat"
files: ^ui-service/.*$
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: "[signal-service] isort"
files: ^signal-service/.*$
args: ["--profile", "black", "--filter-files"]
- id: isort
name: "[ui-service] isort"
files: ^ui-service/.*$
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/adrienverge/yamllint
rev: "v1.28.0"
hooks:
- id: yamllint
alias: lint
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.13.0
hooks:
- id: markdownlint-cli2
alias: lint
- repo: https://github.com/python-poetry/poetry
# Poetry does not work well with `pre-commit autoupdate`, so you may want to
# avoid updating the below `rev`. See:
# https://python-poetry.org/docs/master/pre-commit-hooks/#why-does-pre-commit-autoupdate-not-update-to-the-latest-version.
rev: "1.7.0" # 1.7.0
hooks:
# SignalService Poetry hooks.
- id: poetry-check
name: "[signal-service] poetry check"
args: ["-C", "./signal-service"]
- id: poetry-lock
name: "[signal-service] poetry lock"
args: ["-C", "./signal-service"]
# UiService Poetry hooks.
- id: poetry-check
name: "[ui-service] poetry check"
args: ["-C", "./ui-service"]
- id: poetry-lock
name: "[ui-service] poetry lock"
args: ["-C", "./ui-service"]
- repo: local
hooks:
# Custom client hooks.
- id: client-format
alias: format
name: "[client] format"
entry: bash -c "cd client && npm run format"
language: node
files: ^client/.*$
- id: client-lint
alias: lint
name: "[client] lint"
entry: bash -c "cd client && npm run lint:fix"
language: node
files: ^client/.*$
stages: [push]
- id: client-unittest
alias: unittest
name: "[client] unittest"
entry: bash -c "cd client && npm run test:ci"
language: node
files: ^client/.*$
require_serial: true
stages: [push]
# Custom SignalService hooks.
- id: poetry-install
name: "[signal-service] install Poetry dependencies"
entry: >
bash -c "cd signal-service &&
poetry install --no-interaction --no-root --quiet"
language: system
always_run: true
pass_filenames: false
stages: [post-checkout]
- id: signal-service-lint
alias: lint
name: "[signal-service] Pylint"
entry: >
bash -c "cd signal-service &&
poetry run pylint -rn -sn ./src"
language: system
files: ^signal-service/.*\.py$
types: [python]
pass_filenames: false
require_serial: true
stages: [push]
- id: signal-service-pytype
alias: pytype
name: "[signal-service] Pytype"
entry: >
bash -c "cd signal-service &&
poetry run pytype src"
language: system
files: ^signal-service/.*\.py$
types: [python]
require_serial: true
stages: [push]
- id: signal-service-unittest
alias: unittest
name: "[signal-service] unittest"
entry: >
bash -c "cd signal-service &&
poetry run python -m unittest discover -v -s ./src -p '*_test.py'"
language: system
files: ^signal-service/.*$
types: [python]
stages: [push]
# Custom UiService hooks.
- id: poetry-install
name: "[ui-service] install Poetry dependencies"
entry: >
bash -c "cd ui-service &&
poetry install --no-interaction --no-root --quiet"
language: system
always_run: true
pass_filenames: false
stages: [post-checkout]
- id: ui-service-lint
alias: lint
name: "[ui-service] Pylint"
entry: >
bash -c "cd ui-service &&
poetry run pylint -rn -sn ./src"
language: system
files: ^ui-service/.*\.py$
types: [python]
pass_filenames: false
require_serial: true
stages: [push]
- id: ui-service-pytype
alias: pytype
name: "[ui-service] Pytype"
entry: >
bash -c "cd ui-service &&
poetry run pytype src"
language: system
files: ^ui-service/.*\.py$
types: [python]
require_serial: true
stages: [push]
- id: ui-service-unittest
alias: unittest
name: "[ui-service] unittest"
entry: >
bash -c "cd ui-service &&
poetry run python -m unittest discover -v -s ./src -p '*_test.py'"
language: system
files: ^ui-service/.*$
types: [python]
stages: [push]