summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorMoritz Röhrich <moritz@ildefons.de>2021-07-05 14:54:03 +0200
committerGitHub <noreply@github.com>2021-07-05 21:54:03 +0900
commit958f30c1635ffc7cd47b929b382a791a9d0db37b (patch)
tree59071b344db866dff9e86eaa2ac3510327bac4f2 /ale_linters
parentaf13c350d2499aaa42f77ad8cfc070e97df06dd2 (diff)
downloadale-958f30c1635ffc7cd47b929b382a791a9d0db37b.zip
hadolint: multiple fixes and adapt expected format (#3678)
- Show hadolint rule number in vim gutter in addition to `ALEDetails` - Capture and show error in case of syntax errors - Add tests for error capture - Adapt existing tests fixes: #2333 fixes: #958
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/dockerfile/hadolint.vim6
1 files changed, 5 insertions, 1 deletions
diff --git a/ale_linters/dockerfile/hadolint.vim b/ale_linters/dockerfile/hadolint.vim
index e83cfdfd..45b03aed 100644
--- a/ale_linters/dockerfile/hadolint.vim
+++ b/ale_linters/dockerfile/hadolint.vim
@@ -7,7 +7,7 @@ call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint')
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
" Matches patterns line the following:
"
- " /dev/stdin:19 DL3001 Pipe chain should start with a raw value.
+ " -:19 DL3001 warning: 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 = []
@@ -38,6 +38,8 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
let l:text = l:match[8]
let l:detail = l:match[8]
let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
+ let l:code = ''
+ let l:link = ''
if l:match[4] is# 'SC'
let l:domain = 'https://github.com/koalaman/shellcheck/wiki/'
@@ -46,9 +48,11 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
if l:match[5] isnot# ''
let l:code = l:match[4] . l:match[5]
let l:link = ' ( ' . l:domain . l:code . ' )'
+ let l:text = l:code . ': ' . l:detail
let l:detail = l:code . l:link . "\n\n" . l:detail
else
let l:type = 'E'
+ let l:detail = 'hadolint could not parse the file because of a syntax error.'
endif
call add(l:output, {