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:30:40 +0100
commit1fcf6444dcee5a1b2e6949f435c01d8e325bb3bf (patch)
tree5075f92380d06e6e7bd5d6c75fbbd1be9dc89f31
parente57978ddd689fb91c69c5d4845d3216d9b59bce5 (diff)
downloadale-1fcf6444dcee5a1b2e6949f435c01d8e325bb3bf.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(''))