From 9518ea9accc4376626a14d718984124fc8cd37fc Mon Sep 17 00:00:00 2001 From: w0rp Date: Thu, 6 Sep 2018 09:23:36 +0100 Subject: [PATCH] Fix #1866 - Handle empty output from Perl --- ale_linters/perl/perl.vim | 4 ++++ test/handler/test_perl_handler.vader | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/ale_linters/perl/perl.vim b/ale_linters/perl/perl.vim index d1dcbc9c..420ad9c4 100644 --- a/ale_linters/perl/perl.vim +++ b/ale_linters/perl/perl.vim @@ -14,6 +14,10 @@ let s:begin_failed_skip_pattern = '\v' . join([ \], '|') function! ale_linters#perl#perl#Handle(buffer, lines) abort + if empty(a:lines) + return [] + endif + let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)' let l:output = [] let l:basename = expand('#' . a:buffer . ':t') diff --git a/test/handler/test_perl_handler.vader b/test/handler/test_perl_handler.vader index c5791d76..e769550c 100644 --- a/test/handler/test_perl_handler.vader +++ b/test/handler/test_perl_handler.vader @@ -7,6 +7,11 @@ After: call ale#test#RestoreDirectory() call ale#linter#Reset() +Execute(The Perl linter should handle empty output): + call ale#test#SetFilename('bar.pl') + + AssertEqual [], ale_linters#perl#perl#Handle(bufnr(''), []) + Execute(The Perl linter should ignore errors from other files): call ale#test#SetFilename('bar.pl')