summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorFletcher Nichol <fnichol@nichol.ca>2019-04-18 16:48:10 -0600
committerFletcher Nichol <fnichol@nichol.ca>2019-04-18 16:48:10 -0600
commit2303b05baab5b1a54f42d9d1ab2bff05970ebbb2 (patch)
tree3226f0b2d9b1a978b62c613d51538422a7cbae6e /ale_linters
parentfcc2c3ba71afa2a7965f3c1e9ec8c03381178180 (diff)
downloadale-2303b05baab5b1a54f42d9d1ab2bff05970ebbb2.zip
Add g:ale_sh_shellcheck_change_directory
Diffstat (limited to 'ale_linters')
-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 : '')