summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/ruby/brakeman.vim15
-rw-r--r--ale_linters/ruby/rails_best_practices.vim10
-rw-r--r--ale_linters/ruby/reek.vim15
-rw-r--r--ale_linters/ruby/rubocop.vim4
4 files changed, 13 insertions, 31 deletions
diff --git a/ale_linters/ruby/brakeman.vim b/ale_linters/ruby/brakeman.vim
index 099254a9..122e0b5b 100644
--- a/ale_linters/ruby/brakeman.vim
+++ b/ale_linters/ruby/brakeman.vim
@@ -3,15 +3,7 @@
call ale#Set('ruby_brakeman_options', '')
call ale#Set('ruby_brakeman_executable', 'brakeman')
-
-let g:ale_ruby_brakeman_options =
-\ get(g:, 'ale_ruby_brakeman_options', '')
-
-function! ale_linters#ruby#brakeman#GetExecutable(buffer) abort
- let l:executable = ale#Var(a:buffer, 'ruby_brakeman_executable')
-
- return ale#handlers#ruby#EscapeExecutable(l:executable, 'brakeman')
-endfunction
+call ale#Set('ruby_brakeman_options', '')
function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
let l:output = []
@@ -36,14 +28,15 @@ function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
endfunction
function! ale_linters#ruby#brakeman#GetCommand(buffer) abort
- let l:executable = ale_linters#ruby#brakeman#GetExecutable(a:buffer)
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
if l:rails_root is? ''
return ''
endif
- return l:executable
+ let l:executable = ale#Var(a:buffer, 'ruby_brakeman_executable')
+
+ return ale#handlers#ruby#EscapeExecutable(l:executable, 'brakeman')
\ . ' -f json -q '
\ . ale#Var(a:buffer, 'ruby_brakeman_options')
\ . ' -p ' . ale#Escape(l:rails_root)
diff --git a/ale_linters/ruby/rails_best_practices.vim b/ale_linters/ruby/rails_best_practices.vim
index 9330c03f..20cadca8 100644
--- a/ale_linters/ruby/rails_best_practices.vim
+++ b/ale_linters/ruby/rails_best_practices.vim
@@ -22,24 +22,18 @@ function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort
return l:output
endfunction
-function! ale_linters#ruby#rails_best_practices#GetExecutable(buffer) abort
- let l:executable = ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
-
- return ale#handlers#ruby#EscapeExecutable(l:executable, 'rails_best_practices')
-endfunction
-
function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort
- let l:executable = ale_linters#ruby#rails_best_practices#GetExecutable(a:buffer)
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
if l:rails_root is? ''
return ''
endif
+ let l:executable = ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
let l:output_file = ale#Has('win32') ? '%t ' : '/dev/stdout '
let l:cat_file = ale#Has('win32') ? '; type %t' : ''
- return l:executable
+ return ale#handlers#ruby#EscapeExecutable(l:executable, 'rails_best_practices')
\ . ' --silent -f json --output-file ' . l:output_file
\ . ale#Var(a:buffer, 'ruby_rails_best_practices_options')
\ . ale#Escape(l:rails_root)
diff --git a/ale_linters/ruby/reek.vim b/ale_linters/ruby/reek.vim
index 26a26a13..eefc4ecf 100644
--- a/ale_linters/ruby/reek.vim
+++ b/ale_linters/ruby/reek.vim
@@ -6,12 +6,6 @@ call ale#Set('ruby_reek_show_wiki_link', 0)
call ale#Set('ruby_reek_options', '')
call ale#Set('ruby_reek_executable', 'reek')
-function! ale_linters#ruby#reek#GetExecutable(buffer) abort
- let l:executable = ale#Var(a:buffer, 'ruby_reek_executable')
-
- return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek')
-endfunction
-
function! ale_linters#ruby#reek#VersionCheck(buffer) abort
" If we have previously stored the version number in a cache, then
" don't look it up again.
@@ -20,21 +14,22 @@ function! ale_linters#ruby#reek#VersionCheck(buffer) abort
return ''
endif
- let l:executable = ale_linters#ruby#reek#GetExecutable(a:buffer)
+ let l:executable = ale#Var(a:buffer, 'ruby_reek_executable')
- return l:executable . ' --version'
+ return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek')
+ \ . ' --version'
endfunction
function! ale_linters#ruby#reek#GetCommand(buffer, version_output) abort
let l:version = ale#semver#GetVersion('reek', a:version_output)
- let l:executable = ale_linters#ruby#reek#GetExecutable(a:buffer)
+ let l:executable = ale#Var(a:buffer, 'ruby_reek_executable')
" Tell reek what the filename is if the version of reek is new enough.
let l:display_name_args = ale#semver#GTE(l:version, [5, 0, 0])
\ ? ' --stdin-filename %s'
\ : ''
- return l:executable
+ return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek')
\ . ' -f json --no-progress --no-color'
\ . l:display_name_args
endfunction
diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim
index dce27e3c..58d73407 100644
--- a/ale_linters/ruby/rubocop.vim
+++ b/ale_linters/ruby/rubocop.vim
@@ -2,9 +2,9 @@
" Description: RuboCop, a code style analyzer for Ruby files
function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
- let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer)
+ let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
- return l:executable
+ return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop')
\ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'ruby_rubocop_options')
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))