Merge pull request #1009 from sirbrillig/add/phpcs-include-code-option
phpcs: include sniff code in message
This commit is contained in:
commit
6ed456f99c
2 changed files with 10 additions and 2 deletions
|
@ -29,11 +29,12 @@ 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)
|
||||
let l:text = l:match[4]
|
||||
let l:code = l:match[5]
|
||||
let l:text = l:match[4] . ' (' . l:code . ')'
|
||||
let l:type = l:match[3]
|
||||
|
||||
call add(l:output, {
|
||||
|
|
7
test/test_phpcs_include_code.vader
Normal file
7
test/test_phpcs_include_code.vader
Normal file
|
@ -0,0 +1,7 @@
|
|||
Execute(errors should include code):
|
||||
AssertEqual
|
||||
\ [{'lnum': 18, 'col': 3, 'type': 'E', 'text': 'Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)'}],
|
||||
\ 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)',
|
||||
\ ])
|
||||
|
Reference in a new issue