From 1ca233484604eea2a1fc2027c6dfc8d7a90f5f89 Mon Sep 17 00:00:00 2001 From: Fenner Macrae <13209544+fennerm@users.noreply.github.com> Date: Tue, 26 Jun 2018 16:58:34 -0700 Subject: [PATCH] Fix prospector empty string error Prospector linter is raising error when no warnings are present in file (#1680). Copied fix from #779. --- ale_linters/python/prospector.vim | 4 ++++ test/handler/test_prospector_handler.vader | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/ale_linters/python/prospector.vim b/ale_linters/python/prospector.vim index 66af598a..f2968a05 100644 --- a/ale_linters/python/prospector.vim +++ b/ale_linters/python/prospector.vim @@ -23,6 +23,10 @@ endfunction function! ale_linters#python#prospector#Handle(buffer, lines) abort let l:output = [] + if empty(a:lines) + return [] + endif + let l:prospector_error = json_decode(join(a:lines, '')) for l:error in l:prospector_error.messages diff --git a/test/handler/test_prospector_handler.vader b/test/handler/test_prospector_handler.vader index 7962f6cd..935c37da 100644 --- a/test/handler/test_prospector_handler.vader +++ b/test/handler/test_prospector_handler.vader @@ -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(''), [])