summaryrefslogtreecommitdiff
path: root/ale_linters/ruby/brakeman.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/ruby/brakeman.vim')
-rw-r--r--ale_linters/ruby/brakeman.vim24
1 files changed, 2 insertions, 22 deletions
diff --git a/ale_linters/ruby/brakeman.vim b/ale_linters/ruby/brakeman.vim
index 5ea531f1..269c18f0 100644
--- a/ale_linters/ruby/brakeman.vim
+++ b/ale_linters/ruby/brakeman.vim
@@ -15,7 +15,7 @@ function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
for l:warning in l:result.warnings
" Brakeman always outputs paths relative to the Rails app root
- let l:rails_root = s:FindRailsRoot(a:buffer)
+ 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)
@@ -36,7 +36,7 @@ function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
endfunction
function! ale_linters#ruby#brakeman#GetCommand(buffer) abort
- let l:rails_root = s:FindRailsRoot(a:buffer)
+ let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
if l:rails_root ==? ''
return ''
@@ -47,26 +47,6 @@ function! ale_linters#ruby#brakeman#GetCommand(buffer) abort
\ . ' -p ' . ale#Escape(l:rails_root)
endfunction
-function! s:FindRailsRoot(buffer) abort
- " Find the nearest dir contining "app", "db", and "config", and assume it is
- " the root of a Rails app.
- for l:name in ['app', 'config', 'db']
- let l:dir = fnamemodify(
- \ ale#path#FindNearestDirectory(a:buffer, l:name),
- \ ':h:h'
- \)
-
- if l:dir !=# '.'
- \&& isdirectory(l:dir . '/app')
- \&& isdirectory(l:dir . '/config')
- \&& isdirectory(l:dir . '/db')
- return l:dir
- endif
- endfor
-
- return ''
-endfunction
-
call ale#linter#Define('ruby', {
\ 'name': 'brakeman',
\ 'executable': 'brakeman',