summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-10-26 20:29:23 +0100
committerw0rp <devw0rp@gmail.com>2017-10-26 20:29:33 +0100
commit3ac92ea529e41fa733647692e40b6ee5c0622e1d (patch)
tree54518a098d847fa2b142e084d0558c0a3314cc6f
parent3ab069c9bd870c1dc469a2f92475abc13d3b9bb9 (diff)
downloadale-3ac92ea529e41fa733647692e40b6ee5c0622e1d.zip
Fix #1048 - Do not lint files named "."
-rw-r--r--autoload/ale.vim6
-rw-r--r--test/test_should_do_nothing_conditions.vader14
2 files changed, 20 insertions, 0 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim
index 6500b309..15fb53d9 100644
--- a/autoload/ale.vim
+++ b/autoload/ale.vim
@@ -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
diff --git a/test/test_should_do_nothing_conditions.vader b/test/test_should_do_nothing_conditions.vader
index 3afa11ac..23ebd92e 100644
--- a/test/test_should_do_nothing_conditions.vader
+++ b/test/test_should_do_nothing_conditions.vader
@@ -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(''))