mirror of https://github.com/dense-analysis/ale
Fix #1611 - Fix perlcritic escaping on Windows
This commit is contained in:
parent
eaf35bc611
commit
cd0dc0a227
|
@ -18,9 +18,9 @@ function! ale_linters#perl#perlcritic#GetExecutable(buffer) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#perl#perlcritic#GetProfile(buffer) abort
|
||||
|
||||
" first see if we've been overridden
|
||||
let l:profile = ale#Var(a:buffer, 'perl_perlcritic_profile')
|
||||
|
||||
if l:profile is? ''
|
||||
return ''
|
||||
endif
|
||||
|
@ -31,6 +31,7 @@ endfunction
|
|||
|
||||
function! ale_linters#perl#perlcritic#GetCommand(buffer) abort
|
||||
let l:critic_verbosity = '%l:%c %m\n'
|
||||
|
||||
if ale#Var(a:buffer, 'perl_perlcritic_showrules')
|
||||
let l:critic_verbosity = '%l:%c %m [%p]\n'
|
||||
endif
|
||||
|
@ -38,17 +39,11 @@ function! ale_linters#perl#perlcritic#GetCommand(buffer) abort
|
|||
let l:profile = ale_linters#perl#perlcritic#GetProfile(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'perl_perlcritic_options')
|
||||
|
||||
let l:command = ale#Escape(ale_linters#perl#perlcritic#GetExecutable(a:buffer))
|
||||
\ . " --verbose '". l:critic_verbosity . "' --nocolor"
|
||||
|
||||
if l:profile isnot? ''
|
||||
let l:command .= ' --profile ' . ale#Escape(l:profile)
|
||||
endif
|
||||
if l:options isnot? ''
|
||||
let l:command .= ' ' . l:options
|
||||
endif
|
||||
|
||||
return l:command
|
||||
return ale#Escape(ale_linters#perl#perlcritic#GetExecutable(a:buffer))
|
||||
\ . ' --verbose ' . ale#Escape(l:critic_verbosity)
|
||||
\ . ' --nocolor'
|
||||
\ . (!empty(l:profile) ? ' --profile ' . ale#Escape(l:profile) : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
|
||||
|
|
|
@ -30,14 +30,18 @@ Execute(The command should be correct with g:ale_perl_perlcritic_showrules off):
|
|||
let b:ale_perl_perlcritic_showrules = 0
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('perlcritic') . ' --verbose ''%l:%c %m\n'' --nocolor',
|
||||
\ ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m\n')
|
||||
\ . ' --nocolor',
|
||||
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|
||||
|
||||
Execute(The command should be correct with g:ale_perl_perlcritic_showrules on):
|
||||
let b:ale_perl_perlcritic_showrules = 1
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('perlcritic') . ' --verbose ''%l:%c %m [%p]\n'' --nocolor',
|
||||
\ ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m [%p]\n')
|
||||
\ . ' --nocolor',
|
||||
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|
||||
|
||||
Execute(The command search for the profile file when set):
|
||||
|
@ -46,7 +50,9 @@ Execute(The command search for the profile file when set):
|
|||
let b:readme_path = ale#path#Simplify(expand('%:p:h:h:h') . '/README.md')
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('perlcritic') . ' --verbose ''%l:%c %m\n'' --nocolor'
|
||||
\ ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m\n')
|
||||
\ . ' --nocolor'
|
||||
\ . ' --profile ' . ale#Escape(b:readme_path),
|
||||
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|
||||
|
||||
|
@ -54,6 +60,8 @@ Execute(Extra options should be set appropriately):
|
|||
let b:ale_perl_perlcritic_options = 'beep boop'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('perlcritic') . ' --verbose ''%l:%c %m\n'' --nocolor'
|
||||
\ ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m\n')
|
||||
\ . ' --nocolor'
|
||||
\ . ' beep boop',
|
||||
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|
||||
|
|
Loading…
Reference in New Issue