2019-02-10 15:18:55 +00:00
|
|
|
Before:
|
|
|
|
call ale#assert#SetUpLinterTest('python', 'vulture')
|
|
|
|
call ale#test#SetFilename('test.py')
|
|
|
|
|
|
|
|
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
|
|
|
|
|
|
|
After:
|
|
|
|
unlet! b:bin_dir
|
|
|
|
unlet! b:executable
|
|
|
|
|
|
|
|
call ale#assert#TearDownLinterTest()
|
|
|
|
|
|
|
|
Execute(The vulture command callback should lint file directory by default):
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
|
|
|
|
AssertLinter 'vulture', ale#Escape('vulture') . ' .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(The vulture command callback should lint project root, when present):
|
2021-03-01 20:11:10 +00:00
|
|
|
call ale#test#SetFilename('python_paths/no_virtualenv/subdir/foo/bar.py')
|
2019-02-10 15:18:55 +00:00
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinterCwd ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir')
|
|
|
|
AssertLinter 'vulture', ale#Escape('vulture') . ' .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(The option for disabling change directory works and only lints file):
|
|
|
|
let g:ale_python_vulture_change_directory = 0
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinterCwd ''
|
2019-02-10 15:18:55 +00:00
|
|
|
AssertLinter 'vulture', ale#Escape('vulture') . ' %s'
|
|
|
|
|
|
|
|
Execute(The vulture executable should be configurable, and escaped properly):
|
|
|
|
let g:ale_python_vulture_executable = 'executable with spaces'
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinter 'executable with spaces', ale#Escape('executable with spaces') . ' .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(The vulture command callback should let you set options):
|
|
|
|
let g:ale_python_vulture_options = '--some-option'
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinter 'vulture', ale#Escape('vulture') . ' --some-option .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(The vulture command callback should detect virtualenv directories and switch to the project root):
|
2021-03-01 20:11:10 +00:00
|
|
|
call ale#test#SetFilename('python_paths/with_virtualenv/subdir/foo/bar.py')
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
let b:executable = ale#path#Simplify(
|
|
|
|
\ g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/vulture'
|
|
|
|
\)
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinterCwd ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir')
|
|
|
|
AssertLinter b:executable, ale#Escape(b:executable) . ' .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(You should able able to use the global vulture instead):
|
2021-03-01 20:11:10 +00:00
|
|
|
call ale#test#SetFilename('python_paths/with_virtualenv/subdir/foo/bar.py')
|
2019-02-10 15:18:55 +00:00
|
|
|
let g:ale_python_vulture_use_global = 1
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinter 'vulture', ale#Escape('vulture') . ' .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(Setting executable to 'pipenv' appends 'run vulture'):
|
|
|
|
let g:ale_python_vulture_executable = 'path/to/pipenv'
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run vulture' . ' .'
|