Added tests for hadolint

This commit is contained in:
Jose Lorenzo Rodriguez 2018-01-29 22:21:50 +01:00
parent dd413a4732
commit 4df87eaadd
No known key found for this signature in database
GPG Key ID: 6750B2445A75F08D
4 changed files with 27 additions and 6 deletions

View File

@ -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) |

View File

@ -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:

View File

@ -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/
===============================================================================

View File

@ -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...