dockerfile_lint icon indicating copy to clipboard operation
dockerfile_lint copied to clipboard

Color code the output

Open kenden opened this issue 6 years ago • 1 comments

Feature request:

In order to make the error more obvious, it would be nice to color them in red in the output. Like shellcheck does:

image

Then as a user, it's quicker to see a problem.

version:

hadolint --version Haskell Dockerfile Linter 1.11.0-no-git

kenden avatar Aug 16 '18 12:08 kenden

Nothing that a good old Python wrapper can't fix:

https://github.com/mperezi/spring-tasks-app/blob/dockerfile-best-practices/scripts/hadolint.py

Usage:

$ python hadolint.py Dockerfile          # uses the hadolint binary
$ python hadolint.py --docker Dockerfile # uses the dockerized version of hadolint

Expected output (console):

image

Expected output (pipe or file):

FROM openjdk:8
[x] DL3020: Use COPY instead of ADD for files and folders
ADD build/libs/spring-tasks-app-*.jar /app.jar
[!] DL3025: Use arguments JSON notation for CMD and ENTRYPOINT arguments
ENTRYPOINT java -jar /app.jar

You can always enforce no colors with:

$ python hadolint.py --color=never Dockerfile

mikybars avatar Oct 25 '19 09:10 mikybars