From 121fbefeaef165191820aa72858228921bee4416 Mon Sep 17 00:00:00 2001 From: Matthew Armand Date: Fri, 4 Nov 2022 04:07:56 -0400 Subject: Add 'dockerfile_hadolint_options' config setting (#4353) - Add this option so command line arguments can be supplied to hadolint - This will be respected when running in docker and via the executable - Preserve the --no-color and - flags, and add these to the list - Add to docs and tests --- test/test_dockerfile_hadolint_linter.vader | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'test/test_dockerfile_hadolint_linter.vader') diff --git a/test/test_dockerfile_hadolint_linter.vader b/test/test_dockerfile_hadolint_linter.vader index 6e02b212..ba7e2187 100644 --- a/test/test_dockerfile_hadolint_linter.vader +++ b/test/test_dockerfile_hadolint_linter.vader @@ -19,6 +19,7 @@ After: Restore silent! unlet b:ale_dockerfile_hadolint_use_docker silent! unlet b:ale_dockerfile_hadolint_docker_image + silent! unlet b:ale_dockerfile_hadolint_options Execute(linter honors ..._use_docker correctly): @@ -55,15 +56,30 @@ Execute(command is correct when using docker): let b:ale_dockerfile_hadolint_use_docker = 'always' AssertEqual - \ "docker run --rm -i hadolint/hadolint hadolint --no-color -", + \ "docker run --rm -i hadolint/hadolint hadolint --no-color -", \ ale_linters#dockerfile#hadolint#GetCommand(bufnr('')) +Execute(command is correct when using docker and supplying options): + let b:ale_dockerfile_hadolint_use_docker = 'always' + let b:ale_dockerfile_hadolint_options = '--ignore DL3006' + + AssertEqual + \ "docker run --rm -i hadolint/hadolint hadolint --ignore DL3006 --no-color -", + \ ale_linters#dockerfile#hadolint#GetCommand(bufnr('')) Execute(command is correct when not docker): let b:ale_dockerfile_hadolint_use_docker = 'never' AssertEqual - \ "hadolint --no-color -", + \ "hadolint --no-color -", + \ ale_linters#dockerfile#hadolint#GetCommand(bufnr('')) + +Execute(command is correct when not docker and supplying options): + let b:ale_dockerfile_hadolint_use_docker = 'never' + let b:ale_dockerfile_hadolint_options = '--ignore DL3006' + + AssertEqual + \ "hadolint --ignore DL3006 --no-color -", \ ale_linters#dockerfile#hadolint#GetCommand(bufnr('')) Execute(test warnings from hadolint): -- cgit v1.2.3