adding a workflow to check files not ending in .sh

Grische
2025-03-13 18:04:22 +01:00
parent 0b3ece1aca
commit e437f12eed

@@ -21,4 +21,17 @@ test:
- git ls-files --exclude='*.sh' --ignored -c -z | xargs -0r shellcheck
```
If you want to lint *all* shell scripts (i.e. with a shebang), even those not ending on `.sh`:
```yaml
test:
image: koalaman/shellcheck-alpine:latest
stage: test
before_script:
- apk update
- apk add git
script:
- git ls-files -c -z | xargs -0 awk -vORS='\0' 'FNR==1 && /^#!.*sh/ { print FILENAME }') | xargs -0r shellcheck
```
If you want to create a JUnit XML report to see in the GitLab's UI, check the instructions [here](JUnit), additionally checkstyle can also be [transformed](checkstyle2text) back into text again for logging purposes.