2cfa09e02d
See: https://github.com/testdouble/standard StandardRB is to RuboCop what StandardJS is to ESLint. This commit naively copies the RuboCop linter and fixer to point at the standardrb executable. Any other adjustments are very minor (the only I can think of is that standardrb takes a `--fix` option instead of `--auto-correct`). This raises a confusing point to me as both developer and a user: since ale enables all linters by default, won't this run both RuboCop and StandardRB (the results of which will almost always be in conflict with one another)? How does ale already solve for this for the similar case of StandardJS and ESLint?
23 lines
1 KiB
VimL
23 lines
1 KiB
VimL
" Author: Justin Searls https://github.com/searls, ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow
|
|
" based on the ale rubocop linter
|
|
" Description: StandardRB - Ruby Style Guide, with linter & automatic code fixer
|
|
|
|
call ale#Set('ruby_standardrb_executable', 'standardrb')
|
|
call ale#Set('ruby_standardrb_options', '')
|
|
|
|
function! ale_linters#ruby#standardrb#GetCommand(buffer) abort
|
|
let l:executable = ale#Var(a:buffer, 'ruby_standardrb_executable')
|
|
|
|
return ale#handlers#ruby#EscapeExecutable(l:executable, 'standardrb')
|
|
\ . ' --format json --force-exclusion '
|
|
\ . ale#Var(a:buffer, 'ruby_standardrb_options')
|
|
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
|
|
endfunction
|
|
|
|
" standardrb is based on RuboCop so the callback is the same
|
|
call ale#linter#Define('ruby', {
|
|
\ 'name': 'standardrb',
|
|
\ 'executable_callback': ale#VarFunc('ruby_standardrb_executable'),
|
|
\ 'command_callback': 'ale_linters#ruby#standardrb#GetCommand',
|
|
\ 'callback': 'ale#ruby#HandleRubocopOutput',
|
|
\})
|