2020-11-29 12:50:24 +00:00
|
|
|
Before:
|
|
|
|
runtime ale_linters/dockerfile/hadolint.vim
|
|
|
|
|
|
|
|
After:
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Execute(The hadolint handler should handle an empty string response):
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [])
|
|
|
|
|
|
|
|
Execute(The hadolint handler should handle a normal example):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'type': 'W',
|
2021-10-19 06:30:19 +00:00
|
|
|
\ 'code': 'DL3006',
|
2021-07-05 12:54:03 +00:00
|
|
|
\ 'text': "DL3006: Always tag the version of an image explicitly",
|
2020-11-29 12:50:24 +00:00
|
|
|
\ 'detail': "DL3006 ( https://github.com/hadolint/hadolint/wiki/DL3006 )\n\nAlways tag the version of an image explicitly",
|
|
|
|
\ },
|
2021-07-05 12:54:03 +00:00
|
|
|
\ {
|
|
|
|
\ 'lnum': 4,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'type': 'W',
|
2021-10-19 06:30:19 +00:00
|
|
|
\ 'code': 'DL3033',
|
2021-07-05 12:54:03 +00:00
|
|
|
\ 'text': "DL3033: Specify version with `yum install -y <package>-<version>`.",
|
|
|
|
\ 'detail': "DL3033 ( https://github.com/hadolint/hadolint/wiki/DL3033 )\n\nSpecify version with `yum install -y <package>-<version>`.",
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 12,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'type': 'W',
|
2021-10-19 06:30:19 +00:00
|
|
|
\ 'code': 'SC2039',
|
2021-07-05 12:54:03 +00:00
|
|
|
\ 'text': "SC2039: In POSIX sh, brace expansion is undefined.",
|
|
|
|
\ 'detail': "SC2039 ( https://github.com/koalaman/shellcheck/wiki/SC2039 )\n\nIn POSIX sh, brace expansion is undefined.",
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [
|
|
|
|
\ '-:1 DL3006 warning: Always tag the version of an image explicitly',
|
|
|
|
\ '-:4 DL3033 warning: Specify version with `yum install -y <package>-<version>`.',
|
|
|
|
\ '-:12 SC2039 warning: In POSIX sh, brace expansion is undefined.',
|
|
|
|
\ ])
|
|
|
|
|
|
|
|
Execute(The hadolint handler should handle parsing errors):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'col': 1,
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ 'text': "unexpected 'b' expecting '#', ADD, ARG, CMD, COPY, ENTRYPOINT, ENV, EXPOSE, FROM, HEALTHCHECK, LABEL, MAINTAINER, ONBUILD, RUN, SHELL, STOPSIGNAL, USER, VOLUME, WORKDIR, or end of input",
|
|
|
|
\ 'detail': "hadolint could not parse the file because of a syntax error.",
|
|
|
|
\ },
|
2020-11-29 12:50:24 +00:00
|
|
|
\ ],
|
|
|
|
\ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [
|
2021-07-05 12:54:03 +00:00
|
|
|
\ '/dev/stdin:1:1 unexpected ''b'' expecting ''#'', ADD, ARG, CMD, COPY, ENTRYPOINT, ENV, EXPOSE, FROM, HEALTHCHECK, LABEL, MAINTAINER, ONBUILD, RUN, SHELL, STOPSIGNAL, USER, VOLUME, WORKDIR, or end of input',
|
2020-11-29 12:50:24 +00:00
|
|
|
\ ])
|