Complain about incorrect uses of expand('%...')
This commit is contained in:
parent
d41f15bcbc
commit
a0e0408ecc
@ -6,7 +6,9 @@ if !exists('g:ale_go_gometalinter_options')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||||
return 'gometalinter --include=''^' . expand('%:p') . '.*$'' '
|
let l:filename = expand('#' . a:buffer . ':p')
|
||||||
|
|
||||||
|
return 'gometalinter --include=''^' . l:filename . '.*$'' '
|
||||||
\ . ale#Var(a:buffer, 'go_gometalinter_options')
|
\ . ale#Var(a:buffer, 'go_gometalinter_options')
|
||||||
\ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
\ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Description: Set options in files based on regex patterns.
|
" Description: Set options in files based on regex patterns.
|
||||||
|
|
||||||
function! ale#pattern_options#SetOptions() abort
|
function! ale#pattern_options#SetOptions() abort
|
||||||
let l:filename = expand('%:p')
|
let l:filename = expand('%:p') " no-custom-checks
|
||||||
let l:options = {}
|
let l:options = {}
|
||||||
|
|
||||||
for l:pattern in keys(g:ale_pattern_options)
|
for l:pattern in keys(g:ale_pattern_options)
|
||||||
|
@ -55,6 +55,7 @@ check_errors() {
|
|||||||
RETURN_CODE=1
|
RETURN_CODE=1
|
||||||
echo "$match $message"
|
echo "$match $message"
|
||||||
done < <(grep -n "$regex" "$directory"/**/*.vim \
|
done < <(grep -n "$regex" "$directory"/**/*.vim \
|
||||||
|
| grep -v 'no-custom-checks' \
|
||||||
| grep -o '^[^:]\+:[0-9]\+' \
|
| grep -o '^[^:]\+:[0-9]\+' \
|
||||||
| sed 's:^\./::')
|
| sed 's:^\./::')
|
||||||
done
|
done
|
||||||
@ -77,5 +78,6 @@ 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'
|
check_errors 'shellescape(' 'Use ale#Escape instead of shellescape'
|
||||||
|
check_errors "expand(['\"]%" "Use expand('#' . a:buffer . '...') instead. You might get a filename for the wrong buffer."
|
||||||
|
|
||||||
exit $RETURN_CODE
|
exit $RETURN_CODE
|
||||||
|
Loading…
Reference in New Issue
Block a user