From 4df87eaaddfceaddd625294c0e601aebf2f68a85 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Mon, 29 Jan 2018 22:21:50 +0100 Subject: [PATCH] Added tests for hadolint --- README.md | 2 +- ale_linters/dockerfile/hadolint.vim | 2 +- doc/ale-dockerfile.txt | 6 +++--- test/test_dockerfile_hadolint_linter.vader | 23 +++++++++++++++++++++- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c42f4bfa..bd7a705f 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ formatting. | D | [dmd](https://dlang.org/dmd-linux.html) | | Dafny | [dafny](https://rise4fun.com/Dafny) !! | | Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) !!, [language_server](https://github.com/natebosch/dart_language_server) | -| Dockerfile | [hadolint](https://github.com/lukasmartinelli/hadolint) | +| Dockerfile | [hadolint](https://github.com/hadolint/hadolint) | | Elixir | [credo](https://github.com/rrrene/credo), [dialyxir](https://github.com/jeremyjh/dialyxir), [dogma](https://github.com/lpil/dogma) !!| | Elm | [elm-format](https://github.com/avh4/elm-format), [elm-make](https://github.com/elm-lang/elm-make) | | Erb | [erb](https://github.com/jeremyevans/erubi), [erubis](https://github.com/kwatch/erubis) | diff --git a/ale_linters/dockerfile/hadolint.vim b/ale_linters/dockerfile/hadolint.vim index 6e1c7377..7772afbd 100644 --- a/ale_linters/dockerfile/hadolint.vim +++ b/ale_linters/dockerfile/hadolint.vim @@ -2,7 +2,7 @@ " always, yes, never call ale#Set('dockerfile_hadolint_use_docker', 'never') -call ale#Set('dockerfile_hadolint_docker_image', 'lukasmartinelli/hadolint') +call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint') function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort " Matches patterns line the following: diff --git a/doc/ale-dockerfile.txt b/doc/ale-dockerfile.txt index 288addbb..805cc478 100644 --- a/doc/ale-dockerfile.txt +++ b/doc/ale-dockerfile.txt @@ -5,7 +5,7 @@ ALE Dockerfile Integration *ale-dockerfile-options* =============================================================================== hadolint *ale-dockerfile-hadolint* - hadolint can be found at: https://github.com/lukasmartinelli/hadolint + hadolint can be found at: https://github.com/hadolint/hadolint g:ale_dockerfile_hadolint_use_docker *g:ale_dockerfile_hadolint_use_docker* @@ -25,12 +25,12 @@ g:ale_dockerfile_hadolint_use_docker *g:ale_dockerfile_hadolint_use_docker* g:ale_dockerfile_hadolint_image *g:ale_dockerfile_hadolint_image* *b:ale_dockerfile_hadolint_image* Type: |String| - Default: `'lukasmartinelli/hadolint'` + Default: `'hadolint/hadolint'` This variable controls the docker image used to run hadolint. The default is hadolint's author's build, and can be found at: - https://hub.docker.com/r/lukasmartinelli/hadolint/ + https://hub.docker.com/r/hadolint/hadolint/ =============================================================================== diff --git a/test/test_dockerfile_hadolint_linter.vader b/test/test_dockerfile_hadolint_linter.vader index 7262c5b0..3edbb2b6 100644 --- a/test/test_dockerfile_hadolint_linter.vader +++ b/test/test_dockerfile_hadolint_linter.vader @@ -55,7 +55,7 @@ Execute(command is correct when using docker): let b:ale_dockerfile_hadolint_use_docker = 'always' AssertEqual - \ "docker run --rm -i lukasmartinelli/hadolint", + \ "docker run --rm -i hadolint/hadolint", \ ale_linters#dockerfile#hadolint#GetCommand(bufnr('')) @@ -66,4 +66,25 @@ Execute(command is correct when not docker): \ "hadolint -", \ ale_linters#dockerfile#hadolint#GetCommand(bufnr('')) +Execute(test warnings from hadolint): + AssertEqual + \ [{'lnum': 10, 'col': 0, 'type': 'W', 'text': 'Using latest is prone to errors', 'detail': "DL3007 ( https://github.com/hadolint/hadolint/wiki/DL3007 )\n\nUsing latest is prone to errors"}], + \ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [ + \ '/dev/stdin:10 DL3007 Using latest is prone to errors', + \ ]) + +Execute(test warnings from shellcheck): + AssertEqual + \ [{'lnum': 3, 'col': 0, 'type': 'W', 'text': 'bar is referenced but not assigned.', 'detail': "SC2154 ( https://github.com/koalaman/shellcheck/wiki/SC2154 )\n\nbar is referenced but not assigned."}], + \ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [ + \ '/dev/stdin:3 SC2154 bar is referenced but not assigned.', + \ ]) + +Execute(test errors from dockerfile parser): + AssertEqual + \ [{'lnum': 3, 'col': 4, 'type': 'E', 'text': 'unexpected "A" expecting at least one space after ''RUN''', 'detail': 'unexpected "A" expecting at least one space after ''RUN'''}], + \ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [ + \ "/dev/stdin:3:4 unexpected \"A\" expecting at least one space after 'RUN'", + \ ]) + " fin...