summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-07-01 15:43:04 +0100
committerGitHub <noreply@github.com>2017-07-01 15:43:04 +0100
commitb2e730fb5e7633453a0d61849100bf609853f70e (patch)
treeddc9550a8e0a5af1fdc3f7a6f8d130837e18ad3e
parent3f1cab3e7ee3d7e90062e32e7d8c9557077c08a8 (diff)
parent29746d492ef05a527c13cd1f835aaa9153eb8ff4 (diff)
downloadale-b2e730fb5e7633453a0d61849100bf609853f70e.zip
Merge pull request #716 from sobrinho/master
Fix brakeman handler when there is no output
-rw-r--r--ale_linters/ruby/brakeman.vim4
-rw-r--r--test/handler/test_brakeman_handler.vader6
2 files changed, 10 insertions, 0 deletions
diff --git a/ale_linters/ruby/brakeman.vim b/ale_linters/ruby/brakeman.vim
index fa5617df..5ea531f1 100644
--- a/ale_linters/ruby/brakeman.vim
+++ b/ale_linters/ruby/brakeman.vim
@@ -5,6 +5,10 @@ let g:ale_ruby_brakeman_options =
\ get(g:, 'ale_ruby_brakeman_options', '')
function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
+ if len(a:lines) == 0
+ return []
+ endif
+
let l:result = json_decode(join(a:lines, ''))
let l:output = []
diff --git a/test/handler/test_brakeman_handler.vader b/test/handler/test_brakeman_handler.vader
index bc7182e3..6a577beb 100644
--- a/test/handler/test_brakeman_handler.vader
+++ b/test/handler/test_brakeman_handler.vader
@@ -73,3 +73,9 @@ Execute(The brakeman handler should parse JSON correctly):
\ ']',
\ '}'
\ ])
+
+Execute(The brakeman handler should parse JSON correctly when there is no output from brakeman):
+ AssertEqual
+ \ [],
+ \ ale_linters#ruby#brakeman#Handle(347, [
+ \ ])