A Lint Container for Docker
We built this container to provide an easy way to centralise and run linting on any project where you have Docker available. To paraphrase:
The best time to start linting your project was when you started it, but the second best time is today.
Linting can be contagious once you start, so with this all-in-one image you can conveniently add additional linters (markdown linting, yaml linting, etc). Our goal is to support popular linters while still keeping a reasonably small Docker image (~100MB according to Docker Hub).
You will need to run the image while pointing it to your source code and providing a
.lint-condo.yaml file to tell it which lint commands to run. You can see an example of this file in this repository here. As you'll probably observe, it's a list of shell commands.
You can then run it like this:
docker run -v `pwd`:/src/ singapore/lint-condo
Perhaps the best way to run linting is part of Continuous Integration. If you already use such a service, running
lint-condo should be as simple as adding the
lint-condo.yaml file and adding an extra
test line to your CI script. It's recommended to put linting first as that is often the common cause of test failures once you add it. If you don't already use such a service, the easiest to set up for linting is CircleCI and you can use this example
machine: services: - docker dependencies: override: - echo true test: override: - docker run -v `pwd`:/src/ singapore/lint-condo
For our own project linting, we use the
latest version of the image (so we can be the canary in a coal mine) but we also endeavour to tag commits/releases so you can "pin" to these if you like. We use the great service Doppins to keep our
requirements.txt up-to-date. Also note that the Docker Hub generates images from automated builds of the
singapore/lint-condo repository for your peace of mind.
lint-condo echoes the stdout of each linter, followed by a summary of test results. An example of this summary is below:
Summary: ✔ eslint ✔ jscs ✔ jshint ✔ yamllint ✔ markdownlint ✔ proselint ✔ remark ✔ write-good ✔ scss-lint ✔ sass-lint ✔ csslint ✔ stylelint ✔ doiuse ✔ sh test/colors.sh
You can note two important points from the above:
sh test/colors.sh. In our own projects we additional internal "linting" scripts that enforce project guidelines.
If we're missing any linters you'd like, please raise an issue. If you'd like to collaborate or contribute code, please do so as well.