Fix #1048 - Do not lint files named "."

This commit is contained in:
w0rp 2017-10-26 20:29:23 +01:00
parent e57978ddd6
commit 1fcf6444dc
2 changed files with 20 additions and 0 deletions

View file

@ -61,6 +61,12 @@ function! ale#ShouldDoNothing(buffer) abort
return 1
endif
let l:filename = fnamemodify(bufname(a:buffer), ':t')
if l:filename is# '.'
return 1
endif
" Do nothing if running in the sandbox
if ale#util#InSandbox()
return 1

View file

@ -1,6 +1,8 @@
Before:
Save &l:statusline
call ale#test#SetDirectory('/testplugin/test')
let b:funky_command_created = 0
" We will test for the existence of this command, so create one if needed.
@ -10,6 +12,8 @@ Before:
endif
After:
call ale#test#RestoreDirectory()
if b:funky_command_created
delcommand CtrlPFunky
let b:funky_command_created = 0
@ -25,3 +29,13 @@ Execute(ALE shouldn't do much of anything for ctrlp-funky buffers):
let &l:statusline = '%#CtrlPMode2# prt %*%#CtrlPMode1# line %* <mru>={%#CtrlPMode1# funky %*}=<fil> <-> %=%<%#CtrlPMode2# %{getcwd()} %*'
Assert ale#ShouldDoNothing(bufnr(''))
Execute(ALE shouldn't try to check buffers with '.' as the filename):
AssertEqual
\ 0,
\ ale#ShouldDoNothing(bufnr('')),
\ 'ShouldDoNothing() was 1 for some other reason'
silent! noautocmd file .
Assert ale#ShouldDoNothing(bufnr(''))