File: standardrb.vim

package info (click to toggle)
vim-ale 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,764 kB
  • sloc: sh: 499; python: 311; perl: 31; makefile: 4; xml: 4; javascript: 1
file content (23 lines) | stat: -rw-r--r-- 985 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
" 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#ruby#EscapeExecutable(l:executable, 'standardrb')
    \   . ' --format json --force-exclusion '
    \   . ale#Var(a:buffer, 'ruby_standardrb_options')
    \   . ' --stdin %s'
endfunction

" standardrb is based on RuboCop so the callback is the same
call ale#linter#Define('ruby', {
\   'name': 'standardrb',
\   'executable': {b -> ale#Var(b, 'ruby_standardrb_executable')},
\   'command': function('ale_linters#ruby#standardrb#GetCommand'),
\   'callback': 'ale#ruby#HandleRubocopOutput',
\})