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.
This commit is contained in:
max ulidtko 2020-05-06 13:07:08 +03:00
parent 70005134e5
commit 5f4103fb35
1 changed files with 14 additions and 2 deletions

View File

@ -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']
if get(l:object, 'description', 'None') isnot# 'None'
let l:message = l:message . '. ' . l:object['description']
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: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