From 3910b025b2b146c1a509394170c6c149828f8bc7 Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Fri, 22 Sep 2017 16:37:12 -0500 Subject: [PATCH] Move dialect setting before user options (shellcheck) --- ale_linters/sh/shellcheck.vim | 2 +- .../test_shellcheck_command_callback.vader | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ale_linters/sh/shellcheck.vim b/ale_linters/sh/shellcheck.vim index 3a2d33f..004656b 100644 --- a/ale_linters/sh/shellcheck.vim +++ b/ale_linters/sh/shellcheck.vim @@ -44,9 +44,9 @@ function! ale_linters#sh#shellcheck#GetCommand(buffer) abort let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer) return ale_linters#sh#shellcheck#GetExecutable(a:buffer) + \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '') \ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '') - \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '') \ . ' -f gcc -' endfunction diff --git a/test/command_callback/test_shellcheck_command_callback.vader b/test/command_callback/test_shellcheck_command_callback.vader index 0d8fef6..8e22905 100644 --- a/test/command_callback/test_shellcheck_command_callback.vader +++ b/test/command_callback/test_shellcheck_command_callback.vader @@ -45,3 +45,12 @@ Execute(The shellcheck command should include the dialect): AssertEqual \ 'shellcheck -s bash -f gcc -', \ ale_linters#sh#shellcheck#GetCommand(bufnr('')) + +Execute(The shellcheck command should include the dialect before options and exclusions): + let b:is_bash = 1 + let b:ale_sh_shellcheck_options = '--foobar' + let b:ale_sh_shellcheck_exclusions = 'foo,bar' + + AssertEqual + \ 'shellcheck -s bash --foobar -e foo,bar -f gcc -', + \ ale_linters#sh#shellcheck#GetCommand(bufnr(''))