summaryrefslogtreecommitdiff
path: root/ale_linters/dockerfile
diff options
context:
space:
mode:
authorMoritz Röhrich <moritz@ildefons.de>2020-11-29 13:50:24 +0100
committerMoritz Röhrich <moritz@ildefons.de>2020-11-29 15:09:47 +0100
commitd9b74caf43ed2bfeb3f090a18fe8b17fe5438c3f (patch)
treebe4669a4010e091d1ed6bd8eec2c2f420233bb8c /ale_linters/dockerfile
parent03b6978a270107b670b0363d50f3eed4b365ba26 (diff)
downloadale-d9b74caf43ed2bfeb3f090a18fe8b17fe5438c3f.zip
hadolint: Recognize message type
Hadolint is in the process of adding the severity of a lint rule to the commandline output: https://github.com/hadolint/hadolint/pull/501 This change utilizes that to show the severity in vim.
Diffstat (limited to 'ale_linters/dockerfile')
-rw-r--r--ale_linters/dockerfile/hadolint.vim18
1 files changed, 14 insertions, 4 deletions
diff --git a/ale_linters/dockerfile/hadolint.vim b/ale_linters/dockerfile/hadolint.vim
index e57cd76d..bed87642 100644
--- a/ale_linters/dockerfile/hadolint.vim
+++ b/ale_linters/dockerfile/hadolint.vim
@@ -9,7 +9,7 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
"
" /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:pattern = '\v^/dev/stdin:(\d+):?(\d+)? ((DL|SC)(\d+) )?((.+)?: )?(.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
@@ -24,9 +24,19 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
let l:colnum = l:match[2] + 0
endif
- let l:type = 'W'
- let l:text = l:match[6]
- let l:detail = l:match[6]
+ " Shellcheck knows a 'style' severity - pin it to info level as well.
+ if l:match[7] is# 'style'
+ let l:type = 'I'
+ elseif l:match[7] is# 'info'
+ let l:type = 'I'
+ elseif l:match[7] is# 'warning'
+ let l:type = 'W'
+ else
+ let l:type = 'E'
+ endif
+
+ let l:text = l:match[8]
+ let l:detail = l:match[8]
let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
if l:match[4] is# 'SC'