summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-01-30 16:04:44 +0000
committerGitHub <noreply@github.com>2018-01-30 16:04:44 +0000
commit52fe924a139b8ae3d087cba0d9a5199054ae0595 (patch)
tree0c6510dfbd754c024608ab1b008d554825e4b2de /ale_linters
parentc589e3d57d2a4d37445a4b97648c08e1b9741304 (diff)
parent4df87eaaddfceaddd625294c0e601aebf2f68a85 (diff)
downloadale-52fe924a139b8ae3d087cba0d9a5199054ae0595.zip
Merge pull request #1308 from lorenzo/patch-1
Improving hadolint checker
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/dockerfile/hadolint.vim32
1 files changed, 26 insertions, 6 deletions
diff --git a/ale_linters/dockerfile/hadolint.vim b/ale_linters/dockerfile/hadolint.vim
index 5550d698..7772afbd 100644
--- a/ale_linters/dockerfile/hadolint.vim
+++ b/ale_linters/dockerfile/hadolint.vim
@@ -2,31 +2,51 @@
" always, yes, never
call ale#Set('dockerfile_hadolint_use_docker', 'never')
-call ale#Set('dockerfile_hadolint_docker_image', 'lukasmartinelli/hadolint')
+call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint')
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+) (.+)$'
+ " /dev/stdin:19 DL3001 Pipe chain should start with a raw value.
+ " /dev/stdin:19:3 unexpected thing
+ let l:pattern = '\v^/dev/stdin:(\d+):?(\d+)? ((DL|SC)(\d+) )?(.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:lnum = 0
+ let l:colnum = 0
if l:match[1] isnot# ''
let l:lnum = l:match[1] + 0
endif
+ if l:match[2] isnot# ''
+ let l:colnum = l:match[2] + 0
+ endif
+
let l:type = 'W'
- let l:text = l:match[3]
+ let l:text = l:match[6]
+ let l:detail = l:match[6]
+ let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
+
+ if l:match[4] is# 'SC'
+ let l:domain = 'https://github.com/koalaman/shellcheck/wiki/'
+ endif
+
+ if l:match[5] isnot# ''
+ let l:code = l:match[4] . l:match[5]
+ let l:link = ' ( ' . l:domain . l:code . ' )'
+ let l:detail = l:code . l:link . "\n\n" . l:detail
+ else
+ let l:type = 'E'
+ endif
call add(l:output, {
\ 'lnum': l:lnum,
- \ 'col': 0,
+ \ 'col': l:colnum,
\ 'type': l:type,
\ 'text': l:text,
- \ 'nr': l:match[2],
+ \ 'detail': l:detail
\})
endfor