Shellcheck is a static analysis tool for bash scripts: https://www.shellcheck.net
docker build --rm -t aljandor/shellcheck-docker:latest .
docker run --rm -it -v `pwd`:/scripts shl shellcheck /scripts/script.sh
pipelines:
branches:
master:
- step:
name: Run Shellcheck linter
image: aljandor/shellcheck-docker:latest
script:
- shellcheck -V
- find ./scripts -type f -name "*.sh" | sort -u | xargs shellcheck -e SC2034 --color=always
shellcheck:
stage: test
image: aljandor/shellcheck-docker:latest
only:
changes:
- "**/*.bash"
before_script:
- shellcheck -V
script:
- find ./scripts -type f -name "*.sh" | sort -u | xargs shellcheck -e SC2034 --color=always
tags:
- docker
name: Run Shellcheck linter
on:
push:
branches: [ master ]
jobs:
run_shellcheck_linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Shellcheck linter
uses: aljandor/shellcheck-docker:latest
with:
cli-args: "--color=always ./scripts"
---
kind: pipeline
type: docker
name: default
steps:
- name: Run Shellcheck linter
image: aljandor/shellcheck-docker:latest
commands:
- shellcheck --version
- find . -type f -name "*.sh" | sort -u | xargs shellcheck -e SC2034 -e SC1090 --color=always
trigger:
event:
- push
https://hub.docker.com/r/aljandor/shellcheck-docker
Dockerhub is integrated with the repository, it automatically starts the build image from the master branch: aljandor/shellcheck-docker:latest
- tags for shellcheck version