summaryrefslogtreecommitdiff
path: root/ale_linters/dockerfile
diff options
context:
space:
mode:
authormax ulidtko <ulidtko@gmail.com>2020-05-06 13:07:08 +0300
committermax ulidtko <ulidtko@gmail.com>2020-05-06 13:07:08 +0300
commit5f4103fb35ac7776cea5a74c7e04c7004831c13d (patch)
treee837bdd03dcc4381c89701b9d0cdb3df6dc09a26 /ale_linters/dockerfile
parent70005134e5b2d40d176ee5b851ac64a296b22201 (diff)
downloadale-5f4103fb35ac7776cea5a74c7e04c7004831c13d.zip
Improve :ALEDetail for dockerfile_lint
1. The often longish `description` moved away from (supposedly short) statusline `message` into the `detail` section. 2. dockerfile_lint sends `reference_url` pointing to issue explanations. Use that.
Diffstat (limited to 'ale_linters/dockerfile')
-rw-r--r--ale_linters/dockerfile/dockerfile_lint.vim14
1 files changed, 13 insertions, 1 deletions
diff --git a/ale_linters/dockerfile/dockerfile_lint.vim b/ale_linters/dockerfile/dockerfile_lint.vim
index 95768b12..b3a2aa87 100644
--- a/ale_linters/dockerfile/dockerfile_lint.vim
+++ b/ale_linters/dockerfile/dockerfile_lint.vim
@@ -32,14 +32,26 @@ function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort
let l:line = get(l:object, 'line', -1)
let l:message = l:object['message']
+ let l:link = get(l:object, 'reference_url', '')
+ if type(l:link) == type([])
+ " Somehow, reference_url is returned as two-part list.
+ " Anchor markers in that list are sometimes duplicated.
+ " See https://github.com/projectatomic/dockerfile_lint/issues/134
+ let l:link = join(l:link, '')
+ let l:link = substitute(l:link, '##', '#', '')
+ endif
+
+ let l:detail = l:message
if get(l:object, 'description', 'None') isnot# 'None'
- let l:message = l:message . '. ' . l:object['description']
+ let l:detail .= "\n\n" . l:object['description']
endif
+ let l:detail .= "\n\n" . l:link
call add(l:messages, {
\ 'lnum': l:line,
\ 'text': l:message,
\ 'type': ale_linters#dockerfile#dockerfile_lint#GetType(l:type),
+ \ 'detail': l:detail,
\})
endfor
endfor