summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--ale_linters/dockerfile/hadolint.vim45
-rw-r--r--ale_linters/elixir/credo.vim2
-rw-r--r--doc/ale.txt1
4 files changed, 48 insertions, 1 deletions
diff --git a/README.md b/README.md
index b5a6a61f..1b59b632 100644
--- a/README.md
+++ b/README.md
@@ -59,6 +59,7 @@ name. That seems to be the fairest way to arrange this table.
| CSS | [csslint](http://csslint.net/), [stylelint](https://github.com/stylelint/stylelint) |
| Cython (pyrex filetype) | [cython](http://cython.org/) |
| D | [dmd](https://dlang.org/dmd-linux.html)^ |
+| Dockerfile | [hadolint](https://github.com/lukasmartinelli/hadolint) |
| Elixir | [credo](https://github.com/rrrene/credo) |
| Elm | [elm-make](https://github.com/elm-lang/elm-make) |
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html) |
diff --git a/ale_linters/dockerfile/hadolint.vim b/ale_linters/dockerfile/hadolint.vim
new file mode 100644
index 00000000..dc8e642c
--- /dev/null
+++ b/ale_linters/dockerfile/hadolint.vim
@@ -0,0 +1,45 @@
+" Author: hauleth - https://github.com/hauleth
+
+function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
+ " Matches patterns line the following:
+ "
+ " stdin:19: F: Pipe chain should start with a raw value.
+ let l:pattern = '\v^/dev/stdin:?(\d+)? (\S+) (.+)$'
+ let l:output = []
+
+ for l:line in a:lines
+ let l:match = matchlist(l:line, l:pattern)
+
+ if len(l:match) == 0
+ continue
+ endif
+
+ let l:lnum = 0
+
+ if l:match[1] !=# ''
+ let l:lnum = l:match[1] + 0
+ endif
+
+ let l:type = 'W'
+ let l:text = l:match[3]
+
+ " vcol is Needed to indicate that the column is a character.
+ call add(l:output, {
+ \ 'bufnr': a:buffer,
+ \ 'lnum': l:lnum,
+ \ 'vcol': 0,
+ \ 'col': 0,
+ \ 'type': l:type,
+ \ 'text': l:text,
+ \ 'nr': l:match[2],
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('dockerfile', {
+ \ 'name': 'hadolint',
+ \ 'executable': 'hadolint',
+ \ 'command': 'hadolint -',
+ \ 'callback': 'ale_linters#dockerfile#hadolint#Handle' })
diff --git a/ale_linters/elixir/credo.vim b/ale_linters/elixir/credo.vim
index 4ebecf71..f79106d9 100644
--- a/ale_linters/elixir/credo.vim
+++ b/ale_linters/elixir/credo.vim
@@ -1,4 +1,4 @@
-" Author: hauleth - https://github.com/haulethe
+" Author: hauleth - https://github.com/hauleth
function! ale_linters#elixir#credo#Handle(buffer, lines) abort
" Matches patterns line the following:
diff --git a/doc/ale.txt b/doc/ale.txt
index 173951c9..4bed2e02 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -77,6 +77,7 @@ The following languages and tools are supported.
* CSS: 'csslint', 'stylelint'
* Cython (pyrex filetype): 'cython'
* D: 'dmd'
+* Dockerfile: 'hadolint'
* Elixir: 'credo'
* Elm: 'elm-make'
* Erlang: 'erlc'