Commit 1a86bb35 authored by Mario Rodas's avatar Mario Rodas

Add Dockerfile checker with hadolint

parent 820cdf6e
......@@ -5,6 +5,7 @@
- Protobuf with ``protoc`` [GH-1125]
- systemd-analyze with ``systemd-analyze`` [GH-1135]
- Dockerfile with ``hadolint`` [GH-1194]
- New features:
......@@ -15,6 +15,7 @@
(depends-on "coffee-mode")
(depends-on "cperl-mode")
(depends-on "d-mode")
(depends-on "dockerfile-mode")
(depends-on "erlang")
(depends-on "ess")
(depends-on "geiser")
......@@ -256,6 +256,14 @@ to view the docstring of the syntax checker. Likewise, you may use
Flycheck extension which provides a syntax checker to run D unittests
on the fly and report the results with Flycheck.
.. supported-language:: Dockerfile
.. syntax-checker:: dockerfile-hadolint
Check syntax and code style with hadolint_
.. _hadolint:
.. supported-language:: Elixir
.. syntax-checker:: elixir-dogma
......@@ -177,6 +177,7 @@ attention to case differences."
......@@ -6581,6 +6582,25 @@ Requires DMD 2.066 or newer. See URL `'."
(one-or-more " ") (message) line-end))
:modes d-mode)
(flycheck-define-checker dockerfile-hadolint
"A Dockerfile syntax checker using the hadolint.
See URL `'."
:command ("hadolint" "-")
:standard-input t
((error line-start
(file-name) ":" line ":" column " " (message)
(warning line-start
(file-name) ":" line " " (id (one-or-more alnum)) " " (message)
(lambda (errors)
(flycheck-remove-error-file-names "/dev/stdin" errors)))
:modes dockerfile-mode)
(defun flycheck-elixir--find-default-directory (_checker)
"Come up with a suitable default directory to run CHECKER in.
......@@ -2955,6 +2955,24 @@ See and Emacs bug #19206"))
'(13 1 info "instantiated from here: U!()"
:checker d-dmd)))
(flycheck-ert-def-checker-test dockerfile-hadolint dockerfile error
"language/dockerfile/Dockerfile.error" 'dockerfile-mode
'(2 1 error "unexpected 'I' expecting space, \"\\t\", \"ONBUILD\", \"FROM\", \"COPY\", \"RUN\", \"WORKDIR\", \"ENTRYPOINT\", \"VOLUME\", \"EXPOSE\", \"ENV\", \"ARG\", \"USER\", \"LABEL\", \"STOPSIGNAL\", \"CMD\", \"SHELL\", \"MAINTAINER\", \"ADD\", \"#\", \"HEALTHCHECK\" or end of input"
:id nil :checker dockerfile-hadolint)))
(flycheck-ert-def-checker-test dockerfile-hadolint dockerfile warnings
"language/dockerfile/Dockerfile.warning" 'dockerfile-mode
'(1 nil warning "Always tag the version of an image explicitly."
:id "DL3006" :checker dockerfile-hadolint)
'(2 nil warning "Do not use apt-get upgrade or dist-upgrade."
:id "DL3005" :checker dockerfile-hadolint)
'(2 nil warning "Delete the apt-get lists after installing something"
:id "DL3009" :checker dockerfile-hadolint)
'(3 nil warning "Use absolute WORKDIR"
:id "DL3000" :checker dockerfile-hadolint)))
(flycheck-ert-def-checker-test (emacs-lisp emacs-lisp-checkdoc) emacs-lisp nil
"language/emacs-lisp/warnings.el" 'emacs-lisp-mode
FROM debian
RUN apt-get update && apt-get upgrade
WORKDIR usr/src/app
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment