summaryrefslogtreecommitdiff
path: root/ale_linters/python/vulture.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/python/vulture.vim')
-rw-r--r--ale_linters/python/vulture.vim19
1 files changed, 9 insertions, 10 deletions
diff --git a/ale_linters/python/vulture.vim b/ale_linters/python/vulture.vim
index d328d262..84ffd49a 100644
--- a/ale_linters/python/vulture.vim
+++ b/ale_linters/python/vulture.vim
@@ -6,7 +6,6 @@ call ale#Set('python_vulture_options', '')
call ale#Set('python_vulture_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_vulture_change_directory', 1)
-
" The directory to change to before running vulture
function! s:GetDir(buffer) abort
let l:project_root = ale#python#FindProjectRoot(a:buffer)
@@ -16,29 +15,28 @@ function! s:GetDir(buffer) abort
\ : expand('#' . a:buffer . ':p:h')
endfunction
-
function! ale_linters#python#vulture#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_vulture', ['vulture'])
endfunction
+function! ale_linters#python#vulture#GetCwd(buffer) abort
+ if !ale#Var(a:buffer, 'python_vulture_change_directory')
+ return ''
+ endif
-function! ale_linters#python#vulture#GetCommand(buffer) abort
- let l:change_dir = ale#Var(a:buffer, 'python_vulture_change_directory')
- \ ? ale#path#CdString(s:GetDir(a:buffer))
- \ : ''
+ return s:GetDir(a:buffer)
+endfunction
+function! ale_linters#python#vulture#GetCommand(buffer) abort
let l:executable = ale_linters#python#vulture#GetExecutable(a:buffer)
-
let l:exec_args = l:executable =~? 'pipenv$'
\ ? ' run vulture'
\ : ''
-
let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory')
\ ? ' .'
\ : ' %s'
- return l:change_dir
- \ . ale#Escape(l:executable) . l:exec_args
+ return ale#Escape(l:executable) . l:exec_args
\ . ' '
\ . ale#Var(a:buffer, 'python_vulture_options')
\ . l:lint_dest
@@ -74,6 +72,7 @@ endfunction
call ale#linter#Define('python', {
\ 'name': 'vulture',
\ 'executable': function('ale_linters#python#vulture#GetExecutable'),
+\ 'cwd': function('ale_linters#python#vulture#GetCwd'),
\ 'command': function('ale_linters#python#vulture#GetCommand'),
\ 'callback': 'ale_linters#python#vulture#Handle',
\ 'lint_file': 1,