Container images for CI
During the development of my websites, programs and scripts, I frequently use multiple tools that provide syntax/linting checking or automatic code testing. To be able to use these in an automatic CI/CD environment I have made some simple container images for most of them, with sometimes even a custom wrapper script to simplify it.
Some reusable stable images are listed below:
- Yamllint (YAML)
- Jsonlint (JSON)
- ESLint (Javascript/Typescript)
- Flake8 (Python)
- Pylint (Python)
- Pytest (Python)
- Shellcheck (CSS/SCSS)
- Stylelint (Bash)
- PSScriptAnalyzer (Powershell)
Yamllint (YAML)
Yamllint is a syntax checker for YAML configuration files.
Configuration
I personally use .yamllint.yaml but some other formats are also supported.
Usage
docker run --rm -v /local/path:/code hdcore/docker-yamllint:1 yamllint
Image source
Jsonlint (JSON)
@prantlf/jsonlint is a syntax checker for JSON files. This image is based on a fork of the orginal Jsonlint but with much more options and possibilities.
Configuration
I personally use .jsonlintrc.yaml but some other formats are also supported.
Usage
docker run --rm -v /local/path:/code hdcore/docker-jsonlint:1 jsonlint.sh
Image source
ESLint (Javascript)
ESLint is a static analyzer for javascript code.
Configuration
I personally use .eslintrc.cjs but some other formats are also supported.
Usage
docker run --rm -v /local/path:/code hdcore/docker-eslint:8 eslint.sh .
Image source
Flake8 & Pytest (Python)
Flake8 is a static code style checker for python code.
Pytest is a testing framework for python code.
Configuration
I personally use .flake8 as the configuration file for Flake8 and no file for Pytest
Usage
docker run --rm -v /local/path:/code hdcore/docker-flake8:7 flake8
docker run --rm -v /local/path:/code hdcore/docker-flake8:7 pytest \<subfolder\>
Image source
Pylint (Python)
Pylint is a static code style checker for python code.
Configuration
I personally use .pylintrc as the configuration file.
Usage
docker run --rm -v /local/path:/code hdcore/docker-pylint:3 pylint
Image source
PSScriptAnalyzer (Powershell)
PSScriptAnalyzer is a static code style checker for python code.
Configuration
I personally use PSScriptAnalyzerSettings.psd1 as the configuration file.
Usage
docker run --rm -v /local/path:/code hdcore/docker-psscriptanalyzer:1 Invoke-ScriptAnalyzer.sh -Path <directory> -Recurse
Image source
Stylelint (CSS/SCSS)
Stylelint is a static code style checker for stylesheet files.
Configuration
I personally use stylelint.config.mjs as the configuration file.
Usage
docker run --rm -v /local/path:/code hdcore/docker-stylelint:16 stylelint.sh [<extra-shellcheck-arguments>]
Image source
Shellcheck (Bash)
PSScriptAnalyzer is a static code style checker for python code.
Configuration
This has to be done inline the files
Usage
docker run --rm -v /local/path:/code hdcore/docker-shellcheck:stable shellcheck-dir.sh <directory> [<extra-shellcheck-arguments>]