forked from cvat-ai/cvat
-
Notifications
You must be signed in to change notification settings - Fork 0
269 lines (232 loc) · 8.52 KB
/
Copy pathlinters.yml
File metadata and controls
269 lines (232 loc) · 8.52 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
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
name: linters
on: pull_request
jobs:
bandit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run checks
run: |
pipx install $(grep "^bandit" ./dev/requirements.txt)
echo "Bandit version: "$(bandit --version | head -1)
bandit -a file --ini .bandit --recursive .
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run checks
run: |
pipx install $(grep "^black" ./dev/requirements.txt)
echo "Black version: $(black --version)"
black --check --diff .
hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run checks
env:
HADOLINT: "${{ github.workspace }}/hadolint"
HADOLINT_VER: "2.12.0"
VERIFICATION_LEVEL: "error"
run: |
curl -sLo "$HADOLINT" "https://github.com/hadolint/hadolint/releases/download/v$HADOLINT_VER/hadolint-Linux-x86_64"
chmod +x "$HADOLINT"
echo "hadolint version: $("$HADOLINT" --version)"
git ls-files -z 'Dockerfile*' '*/Dockerfile*' | xargs -0 "$HADOLINT" -t "$VERIFICATION_LEVEL"
isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run checks
run: |
pipx install $(grep "^isort" ./dev/requirements.txt)
echo "isort version: $(isort --version-number)"
isort --check --diff --resolve-all-configs .
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: setup-pipx
shell: bash
run: |
# custom cached dir
cache_home_dir="$HOME/.local/pipx"
cache_bin_dir="$HOME/.local/pipx_bin"
# add cached dir to PATH
echo "$cache_bin_dir" >> $GITHUB_PATH
echo "cache_home_dir=$cache_home_dir" >> $GITHUB_OUTPUT
echo "cache_bin_dir=$cache_bin_dir" >> $GITHUB_OUTPUT
echo "version=$(pipx --version)" >> $GITHUB_OUTPUT
echo "python_version=$(python3 --version)" >> $GITHUB_OUTPUT
- id: cache-pipx
uses: actions/cache@v4
with:
path: |
${{ steps.setup-pipx.outputs.cache_home_dir }}
${{ steps.setup-pipx.outputs.cache_bin_dir }}
# cache based on pipx version, python version, and both requirements files
# nb! we need to keep python version in the key because packages might be not compatible between python versions
key: pipx-pylint-${{ steps.setup-pipx.outputs.version}}-${{ steps.setup-pipx.outputs.python_version}}-${{ hashFiles('./dev/requirements.txt', './cvat/requirements/base.txt') }}
- name: Install pylint
if: steps.cache-pipx.outputs.cache-hit != 'true'
shell: bash
env:
# nb! install in our custom cached dir, using /opt will not work because of permission issues
PIPX_HOME: ${{ steps.setup-pipx.outputs.cache_home_dir }}
PIPX_BIN_DIR: ${{ steps.setup-pipx.outputs.cache_bin_dir }}
run: |
pipx install $(grep "^pylint==" ./dev/requirements.txt)
pipx inject pylint \
$(grep "^pylint-.\+==" ./dev/requirements.txt) \
$(grep "^django==" ./cvat/requirements/base.txt)
- name: Run checks
run: |
echo "Pylint version: "$(pylint --version | head -1)
pylint -j0 .
regal:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Regal
uses: StyraInc/setup-regal@33a142b1189004e0f14bf42b15972c67eecce776
with:
version: v0.21.3
- run: regal lint --format=github cvat/apps/*/rules
spellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run checks
run: |
pipx install $(grep "^typos==" ./dev/requirements.txt)
echo "Typos version: $(typos --version )"
typos
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Enable corepack
run: corepack enable yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache yarn cache
uses: actions/cache@v4
id: cache-yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Get yarn version
id: yarn-version
run: |
echo "version=$(node --version)" >> $GITHUB_OUTPUT
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
tests/node_modules
key: ${{ runner.os }}-${{ steps.yarn-version.outputs.version }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ steps.yarn-version.outputs.version }}-nodemodules-
- name: Install dependencies
if: |
steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
steps.cache-node-modules.outputs.cache-hit != 'true'
run: |
yarn install --immutable
(cd tests && yarn install --immutable)
- name: Run checks
run: |
echo "ESLint version: "$(yarn run eslint --version)
yarn run eslint .
remark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Enable corepack
run: corepack enable yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache yarn cache
uses: actions/cache@v4
id: cache-yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Get yarn version
id: yarn-version
run: |
echo "version=$(node --version)" >> $GITHUB_OUTPUT
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-${{ steps.yarn-version.outputs.version }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ steps.yarn-version.outputs.version }}-nodemodules-
- name: Install dependencies
if: |
steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
steps.cache-node-modules.outputs.cache-hit != 'true'
run: |
yarn install --immutable
- name: Run checks
run: |
echo "Remark version: "`npx remark --version`
npx remark --quiet --frail -i .remarkignore .
stylelint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Enable corepack
run: corepack enable yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache yarn cache
uses: actions/cache@v4
id: cache-yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Get yarn version
id: yarn-version
run: |
echo "version=$(node --version)" >> $GITHUB_OUTPUT
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-${{ steps.yarn-version.outputs.version }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ steps.yarn-version.outputs.version }}-nodemodules-
- name: Install dependencies
if: |
steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
steps.cache-node-modules.outputs.cache-hit != 'true'
run: |
yarn install --immutable
- name: Run checks
run: |
echo "StyleLint version: "$(yarn run stylelint --version)
yarn run stylelint '**/*.css' '**/*.scss'