2017-05-06 14:11:43 -04:00
|
|
|
Before:
|
2018-07-15 13:24:53 -04:00
|
|
|
call ale#assert#SetUpLinterTest('python', 'pylint')
|
2017-07-09 17:43:25 -04:00
|
|
|
|
2017-10-08 18:26:50 -04:00
|
|
|
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
2017-05-06 14:30:41 -04:00
|
|
|
let b:command_tail = ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
|
2017-05-06 14:11:43 -04:00
|
|
|
|
|
|
|
After:
|
2017-10-08 18:26:50 -04:00
|
|
|
unlet! b:bin_dir
|
|
|
|
unlet! b:executable
|
2018-07-15 13:24:53 -04:00
|
|
|
unlet! b:command_tail
|
|
|
|
|
|
|
|
call ale#assert#TearDownLinterTest()
|
2017-05-06 14:11:43 -04:00
|
|
|
|
|
|
|
Execute(The pylint callbacks should return the correct default values):
|
2018-07-15 13:24:53 -04:00
|
|
|
AssertLinter 'pylint',
|
2018-04-09 03:41:35 -04:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
2018-07-15 13:24:53 -04:00
|
|
|
\ . ale#Escape('pylint') . ' ' . b:command_tail
|
2017-05-06 14:11:43 -04:00
|
|
|
|
2018-04-17 08:30:30 -04:00
|
|
|
Execute(The option for disabling changing directories should work):
|
|
|
|
let g:ale_python_pylint_change_directory = 0
|
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
AssertLinter 'pylint', ale#Escape('pylint') . ' ' . b:command_tail
|
2018-04-17 08:30:30 -04:00
|
|
|
|
2017-05-06 16:20:02 -04:00
|
|
|
Execute(The pylint executable should be configurable, and escaped properly):
|
|
|
|
let g:ale_python_pylint_executable = 'executable with spaces'
|
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
AssertLinter 'executable with spaces',
|
2018-04-09 03:41:35 -04:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
2018-07-15 13:24:53 -04:00
|
|
|
\ . ale#Escape('executable with spaces') . ' ' . b:command_tail
|
2017-05-06 16:20:02 -04:00
|
|
|
|
2017-05-06 14:11:43 -04:00
|
|
|
Execute(The pylint command callback should let you set options):
|
|
|
|
let g:ale_python_pylint_options = '--some-option'
|
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
AssertLinter 'pylint',
|
2018-04-09 03:41:35 -04:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
2018-07-15 13:24:53 -04:00
|
|
|
\ . ale#Escape('pylint') . ' --some-option' . b:command_tail
|
2017-05-06 14:11:43 -04:00
|
|
|
|
|
|
|
Execute(The pylint callbacks shouldn't detect virtualenv directories where they don't exist):
|
|
|
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py')
|
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
AssertLinter 'pylint',
|
2018-04-09 03:41:35 -04:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
2018-07-15 13:24:53 -04:00
|
|
|
\ . ale#Escape('pylint') . ' ' . b:command_tail
|
2017-05-06 14:11:43 -04:00
|
|
|
|
|
|
|
Execute(The pylint callbacks should detect virtualenv directories):
|
|
|
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
|
|
|
|
2017-12-19 13:23:09 -05:00
|
|
|
let b:executable = ale#path#Simplify(
|
2017-10-08 18:26:50 -04:00
|
|
|
\ g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/pylint'
|
|
|
|
\)
|
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
AssertLinter b:executable,
|
2018-04-09 03:41:35 -04:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
2018-07-15 13:24:53 -04:00
|
|
|
\ . ale#Escape(b:executable) . ' ' . b:command_tail
|
2017-05-06 14:11:43 -04:00
|
|
|
|
|
|
|
Execute(You should able able to use the global pylint instead):
|
|
|
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
|
|
|
let g:ale_python_pylint_use_global = 1
|
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
AssertLinter 'pylint',
|
2018-04-09 03:41:35 -04:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
2018-07-15 13:24:53 -04:00
|
|
|
\ . ale#Escape('pylint') . ' ' . b:command_tail
|
2018-06-04 22:43:02 -04:00
|
|
|
|
|
|
|
Execute(Setting executable to 'pipenv' appends 'run pylint'):
|
|
|
|
let g:ale_python_pylint_executable = 'path/to/pipenv'
|
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
AssertLinter 'path/to/pipenv',
|
2018-06-04 22:43:02 -04:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . ale#Escape('path/to/pipenv') . ' run pylint'
|
2018-07-15 13:24:53 -04:00
|
|
|
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
|