-
-
Notifications
You must be signed in to change notification settings - Fork 150
398 lines (364 loc) Β· 11.8 KB
/
lint.yml
File metadata and controls
398 lines (364 loc) Β· 11.8 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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
name: Lint & Type Check
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ '*' ]
workflow_dispatch:
jobs:
lint:
name: Lint ${{ matrix.name }}
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
# Python (ruff) - Beginner
- name: caesar-cipher
type: ruff
path: PROJECTS/beginner/caesar-cipher
- name: keylogger
type: ruff
path: PROJECTS/beginner/keylogger
- name: dns-lookup
type: ruff
path: PROJECTS/beginner/dns-lookup
- name: metadata-scrubber-tool
type: ruff
path: PROJECTS/beginner/metadata-scrubber-tool
- name: network-traffic-analyzer
type: ruff
path: PROJECTS/beginner/network-traffic-analyzer/python
- name: base64-tool
type: ruff
path: PROJECTS/beginner/base64-tool
- name: c2-beacon-backend
type: ruff
path: PROJECTS/beginner/c2-beacon/backend
# Python (ruff) - Intermediate
- name: api-security-scanner-backend
type: ruff
path: PROJECTS/intermediate/api-security-scanner/backend
- name: siem-dashboard-backend
type: ruff
path: PROJECTS/intermediate/siem-dashboard/backend
# Python (ruff) - Advanced
- name: bug-bounty-platform-backend
type: ruff
path: PROJECTS/advanced/bug-bounty-platform/backend
- name: encrypted-p2p-chat-backend
type: ruff
path: PROJECTS/advanced/encrypted-p2p-chat/backend
- name: api-rate-limiter
type: ruff
path: PROJECTS/advanced/api-rate-limiter
- name: ai-threat-detection-backend
type: ruff
path: PROJECTS/advanced/ai-threat-detection/backend
- name: linux-ebpf-security-tracer
type: ruff
path: PROJECTS/beginner/linux-ebpf-security-tracer
- name: dlp-scanner
type: ruff
path: PROJECTS/intermediate/dlp-scanner
# Biome (frontend)
- name: bug-bounty-platform-frontend
type: biome
path: PROJECTS/advanced/bug-bounty-platform/frontend
- name: c2-beacon-frontend
type: biome
path: PROJECTS/beginner/c2-beacon/frontend
- name: api-security-scanner-frontend
type: biome
path: PROJECTS/intermediate/api-security-scanner/frontend
- name: siem-dashboard-frontend
type: biome
path: PROJECTS/intermediate/siem-dashboard/frontend
- name: encrypted-p2p-chat-frontend
type: biome
path: PROJECTS/advanced/encrypted-p2p-chat/frontend
# Go
- name: simple-vulnerability-scanner
type: go
path: PROJECTS/beginner/simple-vulnerability-scanner
- name: docker-security-audit
type: go
path: PROJECTS/intermediate/docker-security-audit
- name: secrets-scanner
type: go
path: PROJECTS/intermediate/secrets-scanner
# Nim
- name: credential-enumeration
type: nim
path: PROJECTS/intermediate/credential-enumeration
defaults:
run:
working-directory: ${{ matrix.path }}
steps:
- name: Checkout code
uses: actions/checkout@v4
# Ruff Setup
- name: Set up Python
if: matrix.type == 'ruff'
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install ruff
if: matrix.type == 'ruff'
run: pip install ruff
# Biome Setup
- name: Setup Node.js
if: matrix.type == 'biome'
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
if: matrix.type == 'biome'
uses: pnpm/action-setup@v4
with:
version: latest
- name: Cache pnpm store
if: matrix.type == 'biome'
uses: actions/cache@v4
with:
path: ~/.local/share/pnpm/store/v10
key: ${{ runner.os }}-pnpm-${{ matrix.name }}-${{ hashFiles(format('{0}/pnpm-lock.yaml', matrix.path)) }}
restore-keys: |
${{ runner.os }}-pnpm-${{ matrix.name }}-
${{ runner.os }}-pnpm-
- name: Install frontend dependencies
if: matrix.type == 'biome'
run: pnpm install --frozen-lockfile
# Go Setup
- name: Setup Go
if: matrix.type == 'go'
uses: actions/setup-go@v5
with:
go-version-file: ${{ matrix.path }}/go.mod
cache-dependency-path: ${{ matrix.path }}/go.sum
- name: Install golangci-lint
if: matrix.type == 'go'
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
# Nim Setup
- name: Setup Nim
if: matrix.type == 'nim'
run: |
curl https://nim-lang.org/choosenim/init.sh -sSf | bash -s -- -y
echo "$HOME/.nimble/bin" >> $GITHUB_PATH
- name: Install nph
if: matrix.type == 'nim'
run: nimble install -y nph
# Ruff Linting
- name: Run ruff
if: matrix.type == 'ruff'
id: ruff
run: |
echo "Running ruff check..."
if ruff check . > ruff-output.txt 2>&1; then
echo "RUFF_PASSED=true" >> $GITHUB_ENV
echo "No ruff errors found!"
else
echo "RUFF_PASSED=false" >> $GITHUB_ENV
echo "Ruff found issues"
fi
cat ruff-output.txt
continue-on-error: true
# Biome Linting
- name: Run Biome
if: matrix.type == 'biome'
id: biome
run: |
echo "Running Biome check..."
if npx @biomejs/biome check . > biome-output.txt 2>&1; then
echo "BIOME_PASSED=true" >> $GITHUB_ENV
echo "No Biome errors found!"
else
echo "BIOME_PASSED=false" >> $GITHUB_ENV
echo "Biome found issues!"
fi
cat biome-output.txt
continue-on-error: true
# Go Linting
- name: Run golangci-lint
if: matrix.type == 'go'
id: golangci
run: |
echo "Running golangci-lint..."
if golangci-lint run > golangci-output.txt 2>&1; then
echo "GOLANGCI_PASSED=true" >> $GITHUB_ENV
echo "No golangci-lint errors found!"
else
echo "GOLANGCI_PASSED=false" >> $GITHUB_ENV
echo "golangci-lint found issues!"
fi
cat golangci-output.txt
continue-on-error: true
# Nim Linting
- name: Run nph and nim check
if: matrix.type == 'nim'
id: nim
run: |
echo "Running nph format check..."
NPH_OK=true
NIM_OK=true
if nph --check src/ > nim-output.txt 2>&1; then
echo "nph: no formatting issues"
else
NPH_OK=false
echo "nph: formatting issues found"
fi
echo "Running nim check..."
if nim check src/harvester.nim >> nim-output.txt 2>&1; then
echo "nim check: passed"
else
NIM_OK=false
echo "nim check: failed"
fi
if [[ "$NPH_OK" == "true" && "$NIM_OK" == "true" ]]; then
echo "NIM_PASSED=true" >> $GITHUB_ENV
echo "All Nim checks passed!"
else
echo "NIM_PASSED=false" >> $GITHUB_ENV
echo "Nim checks found issues"
fi
cat nim-output.txt
continue-on-error: true
# Create Summary for Ruff
- name: Create Ruff Lint Summary
if: matrix.type == 'ruff'
run: |
{
echo "## Lint Results: ${{ matrix.name }}"
echo ''
if [[ "${{ env.RUFF_PASSED }}" == "true" ]]; then
echo '### Ruff: **Passed**'
echo 'No ruff issues found.'
else
echo '### Ruff: **Issues Found**'
echo '<details><summary>View ruff output</summary>'
echo ''
echo '```'
head -100 ruff-output.txt
echo '```'
echo '</details>'
fi
echo ''
if [[ "${{ env.RUFF_PASSED }}" == "true" ]]; then
echo '---'
echo '### All checks passed!'
else
echo '---'
echo '### Review the issues above'
fi
} >> $GITHUB_STEP_SUMMARY
# Create Summary for Biome
- name: Create Biome Lint Summary
if: matrix.type == 'biome'
run: |
{
echo "## Lint Results: ${{ matrix.name }}"
echo ''
if [[ "${{ env.BIOME_PASSED }}" == "true" ]]; then
echo '### Biome: **Passed**'
echo 'No Biome issues found.'
else
echo '### Biome: **Issues Found**'
echo '<details><summary>View Biome output</summary>'
echo ''
echo '```'
head -100 biome-output.txt
echo '```'
echo '</details>'
fi
echo ''
if [[ "${{ env.BIOME_PASSED }}" == "true" ]]; then
echo '---'
echo '### All checks passed!'
else
echo '---'
echo '### Review the issues above'
fi
} >> $GITHUB_STEP_SUMMARY
# Create Summary for Go
- name: Create Go Lint Summary
if: matrix.type == 'go'
run: |
{
echo "## Lint Results: ${{ matrix.name }}"
echo ''
if [[ "${{ env.GOLANGCI_PASSED }}" == "true" ]]; then
echo '### golangci-lint: **Passed**'
echo 'No golangci-lint issues found.'
else
echo '### golangci-lint: **Issues Found**'
echo '<details><summary>View golangci-lint output</summary>'
echo ''
echo '```'
head -100 golangci-output.txt
echo '```'
echo '</details>'
fi
echo ''
if [[ "${{ env.GOLANGCI_PASSED }}" == "true" ]]; then
echo '---'
echo '### All checks passed!'
else
echo '---'
echo '### Review the issues above'
fi
} >> $GITHUB_STEP_SUMMARY
# Create Summary for Nim
- name: Create Nim Lint Summary
if: matrix.type == 'nim'
run: |
{
echo "## Lint Results: ${{ matrix.name }}"
echo ''
if [[ "${{ env.NIM_PASSED }}" == "true" ]]; then
echo '### nph + nim check: **Passed**'
echo 'No Nim issues found.'
else
echo '### nph + nim check: **Issues Found**'
echo '<details><summary>View Nim output</summary>'
echo ''
echo '```'
head -100 nim-output.txt
echo '```'
echo '</details>'
fi
echo ''
if [[ "${{ env.NIM_PASSED }}" == "true" ]]; then
echo '---'
echo '### All checks passed!'
else
echo '---'
echo '### Review the issues above'
fi
} >> $GITHUB_STEP_SUMMARY
# Exit with proper status
- name: Check lint status
run: |
if [[ "${{ matrix.type }}" == "ruff" ]]; then
if [[ "${{ env.RUFF_PASSED }}" == "false" ]]; then
echo "Ruff lint checks failed"
exit 1
fi
elif [[ "${{ matrix.type }}" == "biome" ]]; then
if [[ "${{ env.BIOME_PASSED }}" == "false" ]]; then
echo "Biome lint checks failed"
exit 1
fi
elif [[ "${{ matrix.type }}" == "go" ]]; then
if [[ "${{ env.GOLANGCI_PASSED }}" == "false" ]]; then
echo "Go lint checks failed"
exit 1
fi
elif [[ "${{ matrix.type }}" == "nim" ]]; then
if [[ "${{ env.NIM_PASSED }}" == "false" ]]; then
echo "Nim lint checks failed"
exit 1
fi
fi
echo "All lint checks passed"