summaryrefslogtreecommitdiff
path: root/ale_linters/sh/shellcheck.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/sh/shellcheck.vim')
-rw-r--r--ale_linters/sh/shellcheck.vim6
1 files changed, 5 insertions, 1 deletions
diff --git a/ale_linters/sh/shellcheck.vim b/ale_linters/sh/shellcheck.vim
index 3920cab8..1d8b6096 100644
--- a/ale_linters/sh/shellcheck.vim
+++ b/ale_linters/sh/shellcheck.vim
@@ -10,6 +10,7 @@ call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_excl
call ale#Set('sh_shellcheck_executable', 'shellcheck')
call ale#Set('sh_shellcheck_dialect', 'auto')
call ale#Set('sh_shellcheck_options', '')
+call ale#Set('sh_shellcheck_change_directory', 1)
function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort
let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
@@ -40,12 +41,15 @@ function! ale_linters#sh#shellcheck#GetCommand(buffer, version) abort
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect')
let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : ''
+ let l:cd_string = ale#Var(a:buffer, 'sh_shellcheck_change_directory')
+ \ ? ale#path#BufferCdString(a:buffer)
+ \ : ''
if l:dialect is# 'auto'
let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer)
endif
- return ale#path#BufferCdString(a:buffer)
+ return l:cd_string
\ . '%e'
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
\ . (!empty(l:options) ? ' ' . l:options : '')