All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: Eddie Lebow https://github.com/elebow
2 " Description: rails_best_practices, a code metric tool for rails projects
4 call ale#Set('ruby_rails_best_practices_options', '')
5 call ale#Set('ruby_rails_best_practices_executable', 'rails_best_practices')
7 function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort
10 for l:warning in ale#util#FuzzyJSONDecode(a:lines, [])
11 if !ale#path#IsBufferPath(a:buffer, l:warning.filename)
16 \ 'lnum': l:warning.line_number + 0,
18 \ 'text': l:warning.message,
25 function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort
26 let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
28 if l:rails_root is? ''
32 let l:executable = ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
33 let l:output_file = has('win32') ? '%t ' : '/dev/stdout '
34 let l:cat_file = has('win32') ? '; type %t' : ''
36 return ale#ruby#EscapeExecutable(l:executable, 'rails_best_practices')
37 \ . ' --silent -f json --output-file ' . l:output_file
38 \ . ale#Var(a:buffer, 'ruby_rails_best_practices_options')
39 \ . ale#Escape(l:rails_root)
43 call ale#linter#Define('ruby', {
44 \ 'name': 'rails_best_practices',
45 \ 'executable': {b -> ale#Var(b, 'ruby_rails_best_practices_executable')},
46 \ 'command': function('ale_linters#ruby#rails_best_practices#GetCommand'),
47 \ 'callback': 'ale_linters#ruby#rails_best_practices#Handle',