aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.vim/autoload/neomake/makers/ft/ruby.vim
diff options
context:
space:
mode:
authorYaroslav <contact@yaroslavps.com>2020-02-25 14:47:03 +0300
committerYaroslav <contact@yaroslavps.com>2020-02-25 14:47:03 +0300
commitd16e82d468eb0d5bb1e662ac4812c0ca6fc0fc64 (patch)
tree6575864b75dc0c9de61b5d523e77dbcff785c998 /dotfiles/.vim/autoload/neomake/makers/ft/ruby.vim
parent69d47128244a06ee28e4b43191ef9216b04bce13 (diff)
downloadvimrice-d16e82d468eb0d5bb1e662ac4812c0ca6fc0fc64.tar.gz
vimrice-d16e82d468eb0d5bb1e662ac4812c0ca6fc0fc64.zip
reorganized repo to be easier to use with GNU stow; added script to stow
Diffstat (limited to 'dotfiles/.vim/autoload/neomake/makers/ft/ruby.vim')
-rw-r--r--dotfiles/.vim/autoload/neomake/makers/ft/ruby.vim90
1 files changed, 90 insertions, 0 deletions
diff --git a/dotfiles/.vim/autoload/neomake/makers/ft/ruby.vim b/dotfiles/.vim/autoload/neomake/makers/ft/ruby.vim
new file mode 100644
index 0000000..ceb6a46
--- /dev/null
+++ b/dotfiles/.vim/autoload/neomake/makers/ft/ruby.vim
@@ -0,0 +1,90 @@
+" vim: ts=4 sw=4 et
+
+function! neomake#makers#ft#ruby#EnabledMakers() abort
+ return ['flog', 'mri', 'rubocop', 'reek', 'rubylint']
+endfunction
+
+function! neomake#makers#ft#ruby#rubocop() abort
+ return {
+ \ 'args': ['--format', 'emacs', '--force-exclusion', '--display-cop-names'],
+ \ 'errorformat': '%f:%l:%c: %t: %m,%E%f:%l: %m',
+ \ 'postprocess': function('neomake#makers#ft#ruby#RubocopEntryProcess'),
+ \ 'output_stream': 'stdout',
+ \ }
+endfunction
+
+function! neomake#makers#ft#ruby#RubocopEntryProcess(entry) abort
+ if a:entry.type ==# 'F' " Fatal error which prevented further processing
+ let a:entry.type = 'E'
+ elseif a:entry.type ==# 'E' " Error for important programming issues
+ let a:entry.type = 'E'
+ elseif a:entry.type ==# 'W' " Warning for stylistic or minor programming issues
+ let a:entry.type = 'W'
+ elseif a:entry.type ==# 'R' " Refactor suggestion
+ let a:entry.type = 'W'
+ elseif a:entry.type ==# 'C' " Convention violation
+ let a:entry.type = 'I'
+ endif
+endfunction
+
+function! neomake#makers#ft#ruby#rubylint() abort
+ return {
+ \ 'exe': 'ruby-lint',
+ \ 'args': ['--presenter', 'syntastic'],
+ \ 'errorformat': '%f:%t:%l:%c: %m',
+ \ }
+endfunction
+
+function! neomake#makers#ft#ruby#mri() abort
+ let errorformat = '%-G%\m%.%#warning: %\%%(possibly %\)%\?useless use of == in void context,'
+ let errorformat .= '%-G%\%.%\%.%\%.%.%#,'
+ let errorformat .=
+ \ '%-GSyntax OK,'.
+ \ '%E%f:%l: syntax error\, %m,'.
+ \ '%Z%p^,'.
+ \ '%W%f:%l: warning: %m,'.
+ \ '%Z%p^,'.
+ \ '%W%f:%l: %m,'.
+ \ '%-C%.%#'
+
+ return {
+ \ 'exe': 'ruby',
+ \ 'args': ['-c', '-T1', '-w'],
+ \ 'errorformat': errorformat,
+ \ 'output_stream': 'both',
+ \ }
+endfunction
+
+function! neomake#makers#ft#ruby#jruby() abort
+ let errorformat =
+ \ '%-GSyntax OK for %f,'.
+ \ '%ESyntaxError in %f:%l: syntax error\, %m,'.
+ \ '%Z%p^,'.
+ \ '%W%f:%l: warning: %m,'.
+ \ '%Z%p^,'.
+ \ '%W%f:%l: %m,'.
+ \ '%-C%.%#'
+
+ return {
+ \ 'exe': 'jruby',
+ \ 'args': ['-c', '-T1', '-w'],
+ \ 'errorformat': errorformat
+ \ }
+endfunction
+
+function! neomake#makers#ft#ruby#reek() abort
+ return {
+ \ 'args': ['--format', 'text', '--single-line'],
+ \ 'errorformat': '%W%f:%l: %m',
+ \ }
+endfunction
+
+function! neomake#makers#ft#ruby#flog() abort
+ return {
+ \ 'errorformat':
+ \ '%W%m %f:%l-%c,' .
+ \ '%-G\s%#,' .
+ \ '%-G%.%#: flog total,' .
+ \ '%-G%.%#: flog/method average,'
+ \ }
+endfunction