#2395 - Handle empty output for redpen
This commit is contained in:
parent
e1e8f0dae1
commit
3eb6d7b3db
3 changed files with 13 additions and 5 deletions
|
@ -4,10 +4,10 @@
|
||||||
function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort
|
function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort
|
||||||
" Only one file was passed to redpen. So response array has only one
|
" Only one file was passed to redpen. So response array has only one
|
||||||
" element.
|
" element.
|
||||||
let l:res = json_decode(join(a:lines))[0]
|
let l:res = get(ale#util#FuzzyJSONDecode(a:lines, []), 0, {})
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:err in l:res.errors
|
for l:err in get(l:res, 'errors', [])
|
||||||
let l:item = {
|
let l:item = {
|
||||||
\ 'text': l:err.message,
|
\ 'text': l:err.message,
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
|
|
|
@ -24,6 +24,9 @@ Execute(Vendor executables should be detected):
|
||||||
|
|
||||||
Execute(The project path should be correct for .git directories):
|
Execute(The project path should be correct for .git directories):
|
||||||
call ale#test#SetFilename('psalm-project/test.php')
|
call ale#test#SetFilename('psalm-project/test.php')
|
||||||
call mkdir(g:dir . '/.git')
|
|
||||||
|
if !isdirectory(g:dir . '/.git')
|
||||||
|
call mkdir(g:dir . '/.git')
|
||||||
|
endif
|
||||||
|
|
||||||
AssertLSPProject g:dir
|
AssertLSPProject g:dir
|
|
@ -80,7 +80,7 @@ Execute(redpen handler should handle errors output):
|
||||||
\ ']',
|
\ ']',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
Execute(redpen handler should no error output):
|
Execute(The redpen handler should handle an empty error list):
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [],
|
\ [],
|
||||||
\ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [
|
\ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [
|
||||||
|
@ -91,3 +91,8 @@ Execute(redpen handler should no error output):
|
||||||
\ ' }',
|
\ ' }',
|
||||||
\ ']',
|
\ ']',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
|
Execute(The redpen handler should handle totally empty output):
|
||||||
|
AssertEqual
|
||||||
|
\ [],
|
||||||
|
\ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [])
|
||||||
|
|
Reference in a new issue