fnichol/check-shell
Docker image with linters (ShellCheck & hadolint) and formatters (shfmt) for POSIX & Bash shell code
2.8K
A Docker image with linters (such as ShellCheck and hadolint) and formatters (such as shfmt) for POSIX, Bash, and mksh shell code.
Table of Contents
The image is hosted on Docker Hub and can be pulled down with:
$ docker pull fnichol/check-shell
This image is intended to be used primarily by CI systems or by developers who
want these tools available on their workstation without explicitly installing
them. As such, there is no entrypoint script and the default CMD
is /bin/sh
.
To use this image in a CI system such as Cirrus CI, it is recommended
that you use the :latest
tag to track the latest published version. For
example, in a .cirrus.yml
file:
container:
image: fnichol/check-shell:latest
check_task:
check_script: find . -type f -name '*.sh' | xargs shellcheck
In a similar vein, you can use this image on your workstation with a locally running Docker Engine by mounting your current project directory into the container and running a tool such as shfmt like so:
$ docker run --rm -v "$(pwd):/src:ro" -w /src fnichol/check-shell \
shfmt -i 2 -ci -bn -d -l build.sh
There are several shell linting tools installed into this image--the specific versions can be determined by inspecting the Dockerfile.
ShellCheck is a static analysis tool for shell scripts. The installed binary is taken from the official Docker image which is statically linked and the software is released under the GNU General Public License, v3.
shfmt is a subproject sh
which is a shell parser, formatter, and
interpreter. The shfmt
tool focuses formatting POSIX Shell,
Bash, and mksh. The installed binary is taken from the
official Docker image which is statically linked and the software
is released under the BSD 3-Clause "New" or "Revised" License
The Haskell Dockerfile Linter, usually known as "hadolint", is a
Dockerfile linter that helps you build best practice
Docker images. It has understanding of RUN
instructions and lints their values
as shell code. The installed binary is taken from the official
Docker image which is statically linked and the software is released under the
GNU General Public License, v3
If you have any problems with or questions about this image, please contact us through a GitHub issue.
You are invited to contribute to new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.
Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.
Created and maintained by Fletcher Nichol (fnichol@nichol.ca).
This Docker image is licensed under the MIT license.
docker pull fnichol/check-shell