Skip to content

Latest commit

History

73 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Docker image for jsonlint

TagLicense

lintbuildnightly

All #awesome-ci Docker images

ansible-lintansibleawesome-cibanditblackcheckmakeeslintfile-lintgofmtgoimportsgolintjsonlintkubevallinkcheckmypyphp-cs-fixerphpcbfphpcsphplintpycodestylepydocstylepylintterraform-docsterragrunt-fmtterragruntyamlfmtyamllint

View Dockerfiles on GitHub.

Available Architectures:amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x

Tiny Alpine-based multistage-build dockerized version of jsonlint[1], which adds additional functionality such as failure on wrong indentation, lint multiple files via wildcard search and being able to ignore files via wildcards. The image is built nightly against multiple stable versions and pushed to Dockerhub.

[1] Official project: https://github.com/zaach/jsonlint

🐳 Available Docker image versions

Docker

Rolling releaess

The following Docker image tags are rolling releases and are built and updated every night.

nightly

Docker TagGit RefJsonlintFlavourAvailable Architectures
latestmasterlatestdefaultamd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
alpinemasterlatestAlpineamd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
1.6master1.6.xdefaultamd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
alpine-1.6.0master1.6.xAlpineamd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x

Point in time releases

The following Docker image tags are built once and can be used for reproducible builds. Its version never changes so you will have to update tags in your pipelines from time to time in order to stay up-to-date.

build

Docker TagGit RefJsonlintFlavourAvailable Architectures
latest-<tag>tag: <tag>latestdefaultamd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
alpine-latest-<tag>tag: <tag>latestAlpineamd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
1.6-<tag>tag: <tag>1.6.xdefaultamd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
alpine-1.6-<tag>tag: <tag>1.6.xAlpineamd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x

Where <tag> refers to the chosen git tag from this repository.

📂 Docker mounts

The working directory inside the Docker container is /data/ and should be mounted locally to where your JSON files are located.

💻 Usage

Display usage

$ docker run --rm cytopia/jsonlint --help
Usage: cytopia/jsonlint [-sti] <PATH-TO-FILE>
cytopia/jsonlint [-sti] <GLOB-PATTERN>
cytopia/jsonlint --version
cytopia/jsonlint --help
-s sort object keys
-t CHAR character(s) to use for indentation
-i <GLOB-PATTERN> Ignore glob pattern when using the GLOB-PATTERN for file search.
(e.g.: -i '\.terraform*.json')
Multiple ignores can be comma separated:
(e.g.: -i '\.terraform*.json,*test.json')
<PATH-TO-FILE> Path to file to validate
<GLOB-PATTERN> Glob pattern for recursive scanning. (e.g.: *\.json)
Anything that "find . -name '<GLOB-PATTERN>'" will take is valid.

Check all JSON files and ignore .terraform/ directories

$ docker run --rm -v $(pwd):/data cytopia/jsonlint -t '' -i '*.terraform/*'*.json

Check all JSON files for wrong indentation

This behaviour is achieved by saving the JSON with fixed indentation within the container in a different location and then applying a diff against the original file.

$ docker run --rm -v $(pwd):/data cytopia/jsonlint -t ''*.json
jsonlint -c -t ' ' ./envs/dev/iam-permission/dev-policy.json
jsonlint -c -t ' ' ./envs/dev/iam-permission/ops-policy.json
--- ./envs/dev/iam-permission/ops-policy.json+++ /tmp/ops-policy.json@@ -154,7 +154,7 @@
"Sid": "SageMakerFull",
"Effect": "Allow",
"Action": [
- "sagemaker:*"+ "sagemaker:*"
],
"Resource": "*"
},

🔄 Related #awesome-ci projects

Docker images

Save yourself from installing lot's of dependencies and pick a dockerized version of your favourite linter below for reproducible local or remote CI tests:

GitHubDockerHubTypeDescription
awesome-ciaci-hub-imgBasicTools for git, file and static source code analysis
file-lintflint-hub-imgBasicBaisc source code analysis
linkchecklinkcheck-hub-imgBasicSearch for URLs in files and validate their HTTP status code
ansibleansible-hub-imgAnsibleMultiple versions and flavours of Ansible
ansible-lintalint-hub-imgAnsibleLint Ansible
gofmtgfmt-hub-imgGoFormat Go source code [1]
goimportsgimp-hub-imgGoFormat Go source code [1]
golintglint-hub-imgGoLint Go code
eslintelint-hub-imgJavascriptLint Javascript code
jsonlintjlint-hub-imgJSONLint JSON files [1]
kubevalkubeval-hub-imgK8sLint Kubernetes files
checkmakecm-hub-imgMakeLint Makefiles
phpcbfpcbf-hub-imgPHPPHP Code Beautifier and Fixer
phpcspcs-hub-imgPHPPHP Code Sniffer
phplintplint-hub-imgPHPPHP Code Linter [1]
php-cs-fixerpcsf-hub-imgPHPPHP Coding Standards Fixer
banditbandit-hub-imgPythonA security linter from PyCQA
blackblack-hub-imgPythonThe uncompromising Python code formatter
mypymypy-hub-imgPythonStatic source code analysis
pycodestylepycs-hub-imgPythonPython style guide checker
pydocstylepyds-hub-imgPythonPython docstyle checker
pylintpylint-hub-imgPythonPython source code, bug and quality checker
terraform-docstfdocs-hub-imgTerraformTerraform doc generator (TF 0.12 ready) [1]
terragrunttg-hub-imgTerraformTerragrunt and Terraform
terragrunt-fmttgfmt-hub-imgTerraformterraform fmt for Terragrunt files [1]
yamlfmtyfmt-hub-imgYamlFormat Yaml files [1]
yamllintylint-hub-imgYamlLint Yaml files

[1] Uses a shell wrapper to add enhanced functionality not available by original project.

Makefiles

Visit cytopia/makefiles for dependency-less, seamless project integration and minimum required best-practice code linting for CI. The provided Makefiles will only require GNU Make and Docker itself removing the need to install anything else.

📄 License

MIT License

Copyright (c) 2019 cytopia

About

Alpine-based multistage-build version of jsonlint with file globbing search for reproducible usage in CI

Topics

Resources

Stars

9 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages