Skip to content

Commit

Permalink
Merge pull request #2150 from mvgrimes/perl-linter-data-fix
Browse files Browse the repository at this point in the history
Update the perl-linter's l:pattern to catch missing errors
  • Loading branch information
w0rp committed Dec 20, 2018
2 parents 5345a5d + c19f2aa commit 73ca1e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ale_linters/perl/perl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function! ale_linters#perl#perl#Handle(buffer, lines) abort
return []
endif

let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
let l:pattern = '\(..\{-}\) at \(..\{-}\) line \(\d\+\)'
let l:output = []
let l:basename = expand('#' . a:buffer . ':t')

Expand Down
16 changes: 16 additions & 0 deletions test/handler/test_perl_handler.vader
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,19 @@ Execute(The Perl linter reports errors even when mixed with warnings):
\ 'syntax error at - line 8, at EOF',
\ 'Execution of t.pl aborted due to compilation errors.',
\ ])

Execute(The Perl linter reports errors even when an additional file location is included):
AssertEqual
\ [
\ {'lnum': '5', 'type': 'E', 'text': '"my" variable $foo masks earlier declaration in same scope'},
\ {'lnum': '6', 'type': 'E', 'text': '"my" variable $foo masks earlier declaration in same scope'},
\ {'lnum': '11', 'type': 'E', 'text': 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?)'},
\ {'lnum': '12', 'type': 'E', 'text': 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?)'},
\ ],
\ ale_linters#perl#perl#Handle(bufnr(''), [
\ '"my" variable $foo masks earlier declaration in same scope at - line 5.',
\ '"my" variable $foo masks earlier declaration in same scope at - line 6, at <DATA> line 1.',
\ 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?) at - line 11.',
\ 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?) at - line 12, <DATA> line 1.',
\ 'Execution of t.pl aborted due to compilation errors.',
\ ])

0 comments on commit 73ca1e7

Please sign in to comment.