fix(ale_linters/phpcs): add support for multiline error messages
This commit is contained in:
parent
08295ce174
commit
e089969404
2 changed files with 11 additions and 2 deletions
|
@ -23,7 +23,7 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort
|
|||
" Matches against lines like the following:
|
||||
"
|
||||
" /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
|
||||
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\))$'
|
||||
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\)).*$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
|
|
|
@ -13,7 +13,16 @@ Execute(phpcs errors should be handled):
|
|||
\ 'type': 'E',
|
||||
\ 'sub_type': 'style',
|
||||
\ 'text': 'Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)',
|
||||
\ }],
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 22,
|
||||
\ 'col': 3,
|
||||
\ 'type': 'E',
|
||||
\ 'sub_type': 'style',
|
||||
\ 'text': 'All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks)',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#php#phpcs#Handle(bufnr(''), [
|
||||
\ '/path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)',
|
||||
\ "/path/to/some-filename.php:22:3: error - All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '\"\n'.",
|
||||
\ ])
|
||||
|
|
Reference in a new issue