Skip to content

Commit

Permalink
add filename to output
Browse files Browse the repository at this point in the history
  • Loading branch information
krsch committed Jan 8, 2021
1 parent 54dd731 commit 0265fa1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ale_linters/php/phan.vim
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function! ale_linters#php#phan#Handle(buffer, lines) abort
let l:pattern = '^Phan error: \(\w\+\): \(.\+\) in \(.\+\) on line \(\d\+\)$'
else
" /path/to/some-filename.php:18 ERRORTYPE message
let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$'
let l:pattern = '^\(.*\):\(\d\+\)\s\(\w\+\)\s\(.\+\)$'
endif

let l:output = []
Expand All @@ -49,13 +49,15 @@ function! ale_linters#php#phan#Handle(buffer, lines) abort
let l:dict = {
\ 'lnum': l:match[4] + 0,
\ 'text': l:match[2],
\ 'filename': l:match[3],
\ 'type': 'W',
\}
else
let l:dict = {
\ 'lnum': l:match[1] + 0,
\ 'text': l:match[3],
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[4],
\ 'type': 'W',
\ 'filename': l:match[1],
\}
endif

Expand Down
2 changes: 2 additions & 0 deletions test/handler/test_php_phan_handler.vader
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ Execute(The php static analyzer handler should parse errors from phan):
\ 'lnum': 25,
\ 'type': 'W',
\ 'text': 'Return type of getValidator is undeclared type \Respect\Validation\Validator',
\ 'filename': 'example.php',
\ },
\ {
\ 'lnum': 66,
\ 'type': 'W',
\ 'text': 'Call to method string from undeclared class \Respect\Validation\Validator',
\ 'filename': 'example.php',
\ },
\ ],
\ ale_linters#php#phan#Handle(347, [
Expand Down

0 comments on commit 0265fa1

Please sign in to comment.