Skip to content

Commit dbd5fd0

Browse files
committed
fix: verify summary respects skip
Signed-off-by: Josef Andersson <josef.andersson@digg.se>
1 parent 6bafd5e commit dbd5fd0

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,71 @@ lint-node-eslint:
250250

251251
All defined `lint-*` recipes are automatically detected and included in the summary.
252252

253+
## Customizing and Skipping Linters
254+
255+
You can override any linter recipe in your project's justfile to customize behavior or skip checks.
256+
257+
### Skip a Linter
258+
259+
To skip a linter completely, override the recipe and output a message containing "Skip" or "Skipping". The verify script will mark it as skipped (yellow `-`) in the summary:
260+
261+
```just
262+
# Skip license compliance checks
263+
lint-license:
264+
@echo "Skipping license check"
265+
266+
# Skip a Java linter
267+
lint-java-checkstyle:
268+
@echo "Skipping Checkstyle"
269+
```
270+
271+
**Result in summary:**
272+
273+
```text
274+
License reuse - skipped
275+
Java Checkstyle checkstyle - skipped
276+
```
277+
278+
### Customize a Linter
279+
280+
Override a recipe to use custom configurations or different tools:
281+
282+
```just
283+
# Use custom shellcheck config
284+
lint-shell:
285+
@shellcheck --severity=warning --exclude=SC2034 **/*.sh
286+
287+
# Run checkstyle with custom rules
288+
lint-java-checkstyle:
289+
@mvn checkstyle:check -Dcheckstyle.config.location=custom-checks.xml
290+
```
291+
292+
### Conditional Linting
293+
294+
Skip linters conditionally based on environment or files:
295+
296+
```just
297+
# Skip license check in development, run in CI
298+
lint-license:
299+
#!/usr/bin/env bash
300+
if [[ "${CI:-}" == "true" ]]; then
301+
{{lint}}/license.sh
302+
else
303+
echo "Skipping license check in development"
304+
fi
305+
306+
# Skip spotbugs if no Java code changed
307+
lint-java-spotbugs:
308+
#!/usr/bin/env bash
309+
if git diff --name-only main | grep -q "\.java$"; then
310+
{{java_lint}}/spotbugs.sh
311+
else
312+
echo "Skipping SpotBugs - no Java files changed"
313+
fi
314+
```
315+
316+
**Note:** The justfile is the interface - `verify.sh` respects all recipe overrides. Changes take effect immediately without updating devbase-justkit.
317+
253318
## Utilities
254319

255320
Use `colors.sh` for consistent output in custom recipes:

scripts/verify.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ run_linters() {
7070
if grep -q "not found in PATH" <<<"$output"; then
7171
status="skip"
7272
details="not in PATH"
73+
elif grep -qiE "Skipping|Skip" <<<"$output"; then
74+
status="skip"
75+
details="skipped"
7376
elif grep -qE "No .* (files? found|to check)|no commits to check" <<<"$output"; then
7477
status="n/a"
7578
details="n/a"

tests/verify.bats

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ EOF
136136
assert_output --partial "Skipping license check"
137137
# Should NOT run actual license check
138138
refute_output --partial "REUSE"
139+
# Should show as skipped in summary
140+
assert_output --partial "skipped"
141+
# Should count as skipped
142+
assert_output --regexp "[0-9]+ skipped"
139143
}
140144

141145
@test "verify.sh respects Java linter recipe overrides" {

0 commit comments

Comments
 (0)