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: aclemons - https://github.com/aclemons
2 " based on the ale rubocop linter
3 " Description: Ruumba, RuboCop linting for ERB templates.
5 call ale#Set('eruby_ruumba_executable', 'ruumba')
6 call ale#Set('eruby_ruumba_options', '')
8 function! ale_linters#eruby#ruumba#GetCommand(buffer) abort
9 let l:executable = ale#Var(a:buffer, 'eruby_ruumba_executable')
11 return ale#ruby#EscapeExecutable(l:executable, 'ruumba')
12 \ . ' --format json --force-exclusion '
13 \ . ale#Var(a:buffer, 'eruby_ruumba_options')
17 function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort
19 let l:errors = json_decode(a:lines[0])
24 if !has_key(l:errors, 'summary')
25 \|| l:errors['summary']['offense_count'] == 0
26 \|| empty(l:errors['files'])
32 for l:error in l:errors['files'][0]['offenses']
33 let l:start_col = l:error['location']['column'] + 0
35 \ 'lnum': l:error['location']['line'] + 0,
37 \ 'end_col': l:start_col + l:error['location']['length'] - 1,
38 \ 'code': l:error['cop_name'],
39 \ 'text': l:error['message'],
40 \ 'type': ale_linters#eruby#ruumba#GetType(l:error['severity']),
47 function! ale_linters#eruby#ruumba#GetType(severity) abort
48 if a:severity is? 'convention'
49 \|| a:severity is? 'warning'
50 \|| a:severity is? 'refactor'
57 call ale#linter#Define('eruby', {
59 \ 'executable': {b -> ale#Var(b, 'eruby_ruumba_executable')},
60 \ 'command': function('ale_linters#eruby#ruumba#GetCommand'),
61 \ 'callback': 'ale_linters#eruby#ruumba#Handle',