Fix prospector empty string error
Prospector linter is raising error when no warnings are present in file (#1680). Copied fix from #779.
This commit is contained in:
parent
c2ab885384
commit
1ca2334846
2 changed files with 9 additions and 0 deletions
|
@ -23,6 +23,10 @@ endfunction
|
||||||
function! ale_linters#python#prospector#Handle(buffer, lines) abort
|
function! ale_linters#python#prospector#Handle(buffer, lines) abort
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
|
if empty(a:lines)
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
let l:prospector_error = json_decode(join(a:lines, ''))
|
let l:prospector_error = json_decode(join(a:lines, ''))
|
||||||
|
|
||||||
for l:error in l:prospector_error.messages
|
for l:error in l:prospector_error.messages
|
||||||
|
|
|
@ -156,3 +156,8 @@ Execute(Ignoring trailing whitespace messages should work):
|
||||||
\ ' ]',
|
\ ' ]',
|
||||||
\ '}',
|
\ '}',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
|
Execute(The prospector handler should handle empty output):
|
||||||
|
AssertEqual
|
||||||
|
\ [],
|
||||||
|
\ ale_linters#python#prospector#Handle(bufnr(''), [])
|
||||||
|
|
Reference in a new issue