summaryrefslogtreecommitdiff
path: root/ale_linters/sh/shellcheck.vim
diff options
context:
space:
mode:
authorKevin Locke <kevin@kevinlocke.name>2019-02-10 09:00:55 -0700
committerKevin Locke <kevin@kevinlocke.name>2019-02-10 09:00:55 -0700
commita0d4eb3699b2d3e7b7e5830950df10d84f370b8e (patch)
treeb1fc2bd99b77bc0bbad70b54de71d6fdf6a10b44 /ale_linters/sh/shellcheck.vim
parent7a48750610bbed164750a3f0fbf0fd9e88fa56c5 (diff)
downloadale-a0d4eb3699b2d3e7b7e5830950df10d84f370b8e.zip
Support ale_sh_shellcheck_dialect to set dialect
As discussed in w0rp/ale#1051, there are cases where it would be useful to be able to specify the dialect explicitly. This commit allows users to do so using the ale_sh_shellcheck_dialect variable. Fixes: w0rp/ale#1051 Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Diffstat (limited to 'ale_linters/sh/shellcheck.vim')
-rw-r--r--ale_linters/sh/shellcheck.vim7
1 files changed, 6 insertions, 1 deletions
diff --git a/ale_linters/sh/shellcheck.vim b/ale_linters/sh/shellcheck.vim
index 0f68e62c..12864722 100644
--- a/ale_linters/sh/shellcheck.vim
+++ b/ale_linters/sh/shellcheck.vim
@@ -8,6 +8,7 @@
" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004'
call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', ''))
call ale#Set('sh_shellcheck_executable', 'shellcheck')
+call ale#Set('sh_shellcheck_dialect', 'auto')
call ale#Set('sh_shellcheck_options', '')
function! ale_linters#sh#shellcheck#GetExecutable(buffer) abort
@@ -53,9 +54,13 @@ function! ale_linters#sh#shellcheck#GetCommand(buffer, version_output) abort
let l:options = ale#Var(a:buffer, 'sh_shellcheck_options')
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
- let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer)
+ let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect')
let l:external_option = ale#semver#GTE(l:version, [0, 4, 0]) ? ' -x' : ''
+ if l:dialect is# 'auto'
+ let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer)
+ endif
+
return ale#path#BufferCdString(a:buffer)
\ . ale#Escape(l:executable)
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')