summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-02-05 23:02:47 +0900
committerGitHub <noreply@github.com>2021-02-05 23:02:47 +0900
commit787ab2a36684838698a0173f29e82715420f117c (patch)
treeb3fb834044610b854de56790d860e35cbed3d8c7
parentf6128058013e9df6191c54e5d985153a86a215c0 (diff)
parentcc67bc0541761fb857ed58ed3c9adbf7ee1b1a9b (diff)
downloadale-787ab2a36684838698a0173f29e82715420f117c.zip
Merge pull request #3529 from krsch/master
phan: add filename to output
-rw-r--r--ale_linters/php/phan.vim8
-rw-r--r--test/handler/test_php_phan_handler.vader2
2 files changed, 7 insertions, 3 deletions
diff --git a/ale_linters/php/phan.vim b/ale_linters/php/phan.vim
index 53cb1ea9..50c6d6e6 100644
--- a/ale_linters/php/phan.vim
+++ b/ale_linters/php/phan.vim
@@ -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 = []
@@ -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
diff --git a/test/handler/test_php_phan_handler.vader b/test/handler/test_php_phan_handler.vader
index 23747925..bbdae5dd 100644
--- a/test/handler/test_php_phan_handler.vader
+++ b/test/handler/test_php_phan_handler.vader
@@ -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, [