]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/ruby/rubocop.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / ale_linters / ruby / rubocop.vim
1 " Author: ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow
2 " Description: RuboCop, a code style analyzer for Ruby files
3
4 call ale#Set('ruby_rubocop_executable', 'rubocop')
5 call ale#Set('ruby_rubocop_options', '')
6
7 function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
8     let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
9
10     return ale#ruby#EscapeExecutable(l:executable, 'rubocop')
11     \   . ' --format json --force-exclusion '
12     \   . ale#Var(a:buffer, 'ruby_rubocop_options')
13     \   . ' --stdin %s'
14 endfunction
15
16 function! ale_linters#ruby#rubocop#GetType(severity) abort
17     if a:severity is? 'convention'
18     \|| a:severity is? 'warning'
19     \|| a:severity is? 'refactor'
20         return 'W'
21     endif
22
23     return 'E'
24 endfunction
25
26 call ale#linter#Define('ruby', {
27 \   'name': 'rubocop',
28 \   'executable': {b -> ale#Var(b, 'ruby_rubocop_executable')},
29 \   'command': function('ale_linters#ruby#rubocop#GetCommand'),
30 \   'callback': 'ale#ruby#HandleRubocopOutput',
31 \})