summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormax ulidtko <ulidtko@gmail.com>2020-05-06 13:43:20 +0300
committermax ulidtko <ulidtko@gmail.com>2020-05-06 14:05:39 +0300
commitc0d74b80944feddc4e8c91e7b1cae47e1533b2c1 (patch)
tree5e483f02957a3228a429c32f074df0121a364137
parent5f4103fb35ac7776cea5a74c7e04c7004831c13d (diff)
downloadale-c0d74b80944feddc4e8c91e7b1cae47e1533b2c1.zip
Fix style and test
-rw-r--r--ale_linters/dockerfile/dockerfile_lint.vim5
-rw-r--r--test/handler/test_dockerfile_lint_handler.vader6
2 files changed, 9 insertions, 2 deletions
diff --git a/ale_linters/dockerfile/dockerfile_lint.vim b/ale_linters/dockerfile/dockerfile_lint.vim
index b3a2aa87..0c0ad533 100644
--- a/ale_linters/dockerfile/dockerfile_lint.vim
+++ b/ale_linters/dockerfile/dockerfile_lint.vim
@@ -33,7 +33,8 @@ function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort
let l:message = l:object['message']
let l:link = get(l:object, 'reference_url', '')
- if type(l:link) == type([])
+
+ if type(l:link) == v:t_list
" 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
@@ -42,9 +43,11 @@ function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort
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, {
diff --git a/test/handler/test_dockerfile_lint_handler.vader b/test/handler/test_dockerfile_lint_handler.vader
index 619b7bde..a73db8cd 100644
--- a/test/handler/test_dockerfile_lint_handler.vader
+++ b/test/handler/test_dockerfile_lint_handler.vader
@@ -26,21 +26,25 @@ Execute(The dockerfile_lint handler should handle a normal example):
\ 'lnum': -1,
\ 'type': 'E',
\ 'text': "Required LABEL name/key 'Name' is not defined",
+ \ 'detail': "Required LABEL name/key 'Name' is not defined\n\nhttp://docs.projectatomic.io/container-best-practices/#_recommended_labels_for_your_project",
\ },
\ {
\ 'lnum': -1,
\ 'type': 'E',
\ 'text': "Required LABEL name/key 'Version' is not defined",
+ \ 'detail': "Required LABEL name/key 'Version' is not defined\n\nhttp://docs.projectatomic.io/container-best-practices/#_recommended_labels_for_your_project",
\ },
\ {
\ 'lnum': 3,
\ 'type': 'I',
- \ 'text': "the MAINTAINER command is deprecated. MAINTAINER is deprecated in favor of using LABEL since Docker v1.13.0",
+ \ 'text': "the MAINTAINER command is deprecated",
+ \ 'detail': "the MAINTAINER command is deprecated\n\nMAINTAINER is deprecated in favor of using LABEL since Docker v1.13.0\n\nhttps://github.com/docker/cli/blob/master/docs/deprecated.md#maintainer-in-dockerfile",
\ },
\ {
\ 'lnum': -1,
\ 'type': 'I',
\ 'text': "There is no 'CMD' instruction",
+ \ 'detail': "There is no 'CMD' instruction\n\nhttps://docs.docker.com/engine/reference/builder/#cmd",
\ },
\ ],
\ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), [