Escape the pylint executable appropriately

This commit is contained in:
w0rp 2017-05-06 21:20:02 +01:00
parent f2c9fc403a
commit 07bcbd4c06
2 changed files with 14 additions and 1 deletions

View File

@ -26,7 +26,7 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort
endfunction endfunction
function! ale_linters#python#pylint#GetCommand(buffer) abort function! ale_linters#python#pylint#GetCommand(buffer) abort
return ale_linters#python#pylint#GetExecutable(a:buffer) return fnameescape(ale_linters#python#pylint#GetExecutable(a:buffer))
\ . ' ' . ale#Var(a:buffer, 'python_pylint_options') \ . ' ' . ale#Var(a:buffer, 'python_pylint_options')
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n' \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n'
\ . ' %s' \ . ' %s'

View File

@ -6,6 +6,9 @@ Before:
After: After:
silent execute 'cd ' . fnameescape(g:dir) silent execute 'cd ' . fnameescape(g:dir)
" Set the file to something else,
" or we'll cause issues when running other tests
silent file 'dummy.py'
unlet! g:dir unlet! g:dir
call ale#linter#Reset() call ale#linter#Reset()
@ -21,6 +24,16 @@ Execute(The pylint callbacks should return the correct default values):
\ 'pylint ' . b:command_tail, \ 'pylint ' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr('')) \ ale_linters#python#pylint#GetCommand(bufnr(''))
Execute(The pylint executable should be configurable, and escaped properly):
let g:ale_python_pylint_executable = 'executable with spaces'
AssertEqual
\ 'executable with spaces',
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
AssertEqual
\ 'executable\ with\ spaces ' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
Execute(The pylint command callback should let you set options): Execute(The pylint command callback should let you set options):
let g:ale_python_pylint_options = '--some-option' let g:ale_python_pylint_options = '--some-option'