mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
" Author: Eddie Lebow https://github.com/elebow
|
||||
" Description: Brakeman, a static analyzer for Rails security
|
||||
|
||||
let g:ale_ruby_brakeman_options =
|
||||
\ get(g:, 'ale_ruby_brakeman_options', '')
|
||||
call ale#Set('ruby_brakeman_options', '')
|
||||
call ale#Set('ruby_brakeman_executable', 'brakeman')
|
||||
call ale#Set('ruby_brakeman_options', '')
|
||||
|
||||
function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
@ -33,14 +34,17 @@ function! ale_linters#ruby#brakeman#GetCommand(buffer) abort
|
||||
return ''
|
||||
endif
|
||||
|
||||
return 'brakeman -f json -q '
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_brakeman_executable')
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'brakeman')
|
||||
\ . ' -f json -q '
|
||||
\ . ale#Var(a:buffer, 'ruby_brakeman_options')
|
||||
\ . ' -p ' . ale#Escape(l:rails_root)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'brakeman',
|
||||
\ 'executable': 'brakeman',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_brakeman_executable'),
|
||||
\ 'command_callback': 'ale_linters#ruby#brakeman#GetCommand',
|
||||
\ 'callback': 'ale_linters#ruby#brakeman#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
@ -22,26 +22,18 @@ function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#rails_best_practices#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#ruby#rails_best_practices#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'bundle$'
|
||||
\ ? ' exec rails_best_practices'
|
||||
\ : ''
|
||||
|
||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||
|
||||
if l:rails_root is? ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
|
||||
let l:output_file = ale#Has('win32') ? '%t ' : '/dev/stdout '
|
||||
let l:cat_file = ale#Has('win32') ? '; type %t' : ''
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'rails_best_practices')
|
||||
\ . ' --silent -f json --output-file ' . l:output_file
|
||||
\ . ale#Var(a:buffer, 'ruby_rails_best_practices_options')
|
||||
\ . ale#Escape(l:rails_root)
|
||||
@ -50,7 +42,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'rails_best_practices',
|
||||
\ 'executable_callback': 'ale_linters#ruby#rails_best_practices#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_rails_best_practices_executable'),
|
||||
\ 'command_callback': 'ale_linters#ruby#rails_best_practices#GetCommand',
|
||||
\ 'callback': 'ale_linters#ruby#rails_best_practices#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
call ale#Set('ruby_reek_show_context', 0)
|
||||
call ale#Set('ruby_reek_show_wiki_link', 0)
|
||||
call ale#Set('ruby_reek_options', '')
|
||||
call ale#Set('ruby_reek_executable', 'reek')
|
||||
|
||||
function! ale_linters#ruby#reek#VersionCheck(buffer) abort
|
||||
" If we have previously stored the version number in a cache, then
|
||||
@ -12,18 +14,23 @@ function! ale_linters#ruby#reek#VersionCheck(buffer) abort
|
||||
return ''
|
||||
endif
|
||||
|
||||
return 'reek --version'
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_reek_executable')
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek')
|
||||
\ . ' --version'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#reek#GetCommand(buffer, version_output) abort
|
||||
let l:version = ale#semver#GetVersion('reek', a:version_output)
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_reek_executable')
|
||||
|
||||
" Tell reek what the filename is if the version of reek is new enough.
|
||||
let l:display_name_args = ale#semver#GTE(l:version, [5, 0, 0])
|
||||
\ ? ' --stdin-filename %s'
|
||||
\ : ''
|
||||
|
||||
return 'reek -f json --no-progress --no-color'
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek')
|
||||
\ . ' -f json --no-progress --no-color'
|
||||
\ . l:display_name_args
|
||||
endfunction
|
||||
|
||||
@ -62,7 +69,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'reek',
|
||||
\ 'executable': 'reek',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_reek_executable'),
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#ruby#reek#VersionCheck'},
|
||||
\ {'callback': 'ale_linters#ruby#reek#GetCommand'},
|
||||
|
@ -1,13 +1,13 @@
|
||||
" Author: ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow
|
||||
" Description: RuboCop, a code style analyzer for Ruby files
|
||||
|
||||
function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
|
||||
let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'bundle$'
|
||||
\ ? ' exec rubocop'
|
||||
\ : ''
|
||||
call ale#Set('ruby_rubocop_executable', 'rubocop')
|
||||
call ale#Set('ruby_rubocop_options', '')
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop')
|
||||
\ . ' --format json --force-exclusion '
|
||||
\ . ale#Var(a:buffer, 'ruby_rubocop_options')
|
||||
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
@ -55,7 +55,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'rubocop',
|
||||
\ 'executable_callback': 'ale#handlers#rubocop#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_rubocop_executable'),
|
||||
\ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand',
|
||||
\ 'callback': 'ale_linters#ruby#rubocop#Handle',
|
||||
\})
|
||||
|
20
sources_non_forked/ale/ale_linters/ruby/solargraph.vim
Normal file
20
sources_non_forked/ale/ale_linters/ruby/solargraph.vim
Normal file
@ -0,0 +1,20 @@
|
||||
" Author: Horacio Sanson - https://github.com/hsanson
|
||||
" Description: Solargraph Language Server https://solargraph.org/
|
||||
"
|
||||
" Author: Devon Meunier <devon.meunier@gmail.com>
|
||||
" Description: updated to use stdio
|
||||
|
||||
call ale#Set('ruby_solargraph_executable', 'solargraph')
|
||||
|
||||
function! ale_linters#ruby#solargraph#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad('stdio')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'solargraph',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': 'ruby',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_solargraph_executable'),
|
||||
\ 'command_callback': 'ale_linters#ruby#solargraph#GetCommand',
|
||||
\ 'project_root_callback': 'ale#ruby#FindProjectRoot',
|
||||
\})
|
Reference in New Issue
Block a user