summaryrefslogtreecommitdiff
path: root/ale_linters/ruby
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-15 18:24:53 +0100
committerw0rp <devw0rp@gmail.com>2018-07-15 18:28:28 +0100
commita42999a639b2916b769a85f37d037be314d9d61b (patch)
tree5ebfb4d357dc673efa93fd32a66b489c4510de40 /ale_linters/ruby
parent5155a35a80fe3b20659eb0f28cc6cc720532dd3f (diff)
downloadale-a42999a639b2916b769a85f37d037be314d9d61b.zip
Massively reduce the amount of code needed for linter tests
Diffstat (limited to 'ale_linters/ruby')
-rw-r--r--ale_linters/ruby/rails_best_practices.vim12
1 files changed, 8 insertions, 4 deletions
diff --git a/ale_linters/ruby/rails_best_practices.vim b/ale_linters/ruby/rails_best_practices.vim
index 107753c3..4ba1f3fe 100644
--- a/ale_linters/ruby/rails_best_practices.vim
+++ b/ale_linters/ruby/rails_best_practices.vim
@@ -1,8 +1,8 @@
" Author: Eddie Lebow https://github.com/elebow
" Description: rails_best_practices, a code metric tool for rails projects
-let g:ale_ruby_rails_best_practices_options =
-\ get(g:, 'ale_ruby_rails_best_practices_options', '')
+call ale#Set('ruby_rails_best_practices_options', '')
+call ale#Set('ruby_rails_best_practices_executable', 'rails_best_practices')
function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort
let l:output = []
@@ -22,8 +22,12 @@ 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
+ return ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
+endfunction
+
function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort
- let l:executable = ale#handlers#rails_best_practices#GetExecutable(a:buffer)
+ let l:executable = ale_linters#ruby#rails_best_practices#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'bundle$'
\ ? ' exec rails_best_practices'
\ : ''
@@ -46,7 +50,7 @@ endfunction
call ale#linter#Define('ruby', {
\ 'name': 'rails_best_practices',
-\ 'executable_callback': 'ale#handlers#rails_best_practices#GetExecutable',
+\ 'executable_callback': 'ale_linters#ruby#rails_best_practices#GetExecutable',
\ 'command_callback': 'ale_linters#ruby#rails_best_practices#GetCommand',
\ 'callback': 'ale_linters#ruby#rails_best_practices#Handle',
\ 'lint_file': 1,