summaryrefslogtreecommitdiff
path: root/ale_linters/ruby/brakeman.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-09-13 23:33:13 +0100
committerw0rp <devw0rp@gmail.com>2017-09-13 23:33:13 +0100
commit52c933cd72ca283eb5ac8542ab10c78ca50bf7cb (patch)
treea8b3eaa4075257358db0ecb999eebc7fe0c797e4 /ale_linters/ruby/brakeman.vim
parent3d2bddf4af7515a6f2b20cf6b5bb8fa5568a1a99 (diff)
downloadale-52c933cd72ca283eb5ac8542ab10c78ca50bf7cb.zip
Report problems in other files for brakeman, and get the tests to pass on Windows
Diffstat (limited to 'ale_linters/ruby/brakeman.vim')
-rw-r--r--ale_linters/ruby/brakeman.vim18
1 files changed, 7 insertions, 11 deletions
diff --git a/ale_linters/ruby/brakeman.vim b/ale_linters/ruby/brakeman.vim
index 790eb563..85cfc184 100644
--- a/ale_linters/ruby/brakeman.vim
+++ b/ale_linters/ruby/brakeman.vim
@@ -7,23 +7,19 @@ let g:ale_ruby_brakeman_options =
function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
let l:output = []
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
+ let l:sep = has('win32') ? '\' : '/'
+ " Brakeman always outputs paths relative to the Rails app root
+ let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
for l:warning in get(l:json, 'warnings', [])
- " Brakeman always outputs paths relative to the Rails app root
- let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
- let l:warning_file = l:rails_root . '/' . l:warning.file
-
- if !ale#path#IsBufferPath(a:buffer, l:warning_file)
- continue
- endif
-
let l:text = l:warning.warning_type . ' ' . l:warning.message . ' (' . l:warning.confidence . ')'
let l:line = l:warning.line != v:null ? l:warning.line : 1
call add(l:output, {
- \ 'lnum': l:line,
- \ 'type': 'W',
- \ 'text': l:text,
+ \ 'filename': l:rails_root . l:sep . l:warning.file,
+ \ 'lnum': l:line,
+ \ 'type': 'W',
+ \ 'text': l:text,
\})
endfor