Complain when shellescape is used instead of ale#Escape

This commit is contained in:
w0rp 2017-05-15 20:21:18 +01:00
parent 113f53a5d2
commit fa3a4b3ba2
2 changed files with 5 additions and 2 deletions

View file

@ -125,12 +125,13 @@ function! ale#Var(buffer, variable_name) abort
endfunction endfunction
" Escape a string suitably for each platform. " Escape a string suitably for each platform.
" shellescape() does not work on Windows. " shellescape does not work on Windows.
function! ale#Escape(str) abort function! ale#Escape(str) abort
if fnamemodify(&shell, ':t') ==? 'cmd.exe' if fnamemodify(&shell, ':t') ==? 'cmd.exe'
" FIXME: Fix shell escaping for Windows. " FIXME: Fix shell escaping for Windows.
return fnameescape(a:str) return fnameescape(a:str)
else else
return shellescape(a:str) " An extra space is used here to disable the custom-checks.
return shellescape (a:str)
endif endif
endfunction endfunction

View file

@ -63,6 +63,7 @@ check_errors() {
if (( FIX_ERRORS )); then if (( FIX_ERRORS )); then
for directory in "${directories[@]}"; do for directory in "${directories[@]}"; do
sed -i "s/^\(function.*)\) *$/\1 abort/" "$directory"/**/*.vim sed -i "s/^\(function.*)\) *$/\1 abort/" "$directory"/**/*.vim
sed -i "s/shellescape(/ale#Escape(/" "$directory"/**/*.vim
done done
fi fi
@ -75,5 +76,6 @@ check_errors '^ [^ ]' 'Use four spaces, not two spaces'
check_errors $'\t' 'Use four spaces, not tabs' check_errors $'\t' 'Use four spaces, not tabs'
# This check should prevent people from using a particular inconsistent name. # This check should prevent people from using a particular inconsistent name.
check_errors 'let g:ale_\w\+_\w\+_args =' 'Name your option g:ale_<filetype>_<lintername>_options instead' check_errors 'let g:ale_\w\+_\w\+_args =' 'Name your option g:ale_<filetype>_<lintername>_options instead'
check_errors 'shellescape(' 'Use ale#Escape instead of shellescape'
exit $RETURN_CODE exit $RETURN_CODE