mirror of
https://github.com/amix/vimrc
synced 2025-07-09 10:45:00 +08:00
Use sources_non_forked folder for pathogen path, with sources_non_forked_fallback folder as fallback.
This commit is contained in:
@ -1,25 +0,0 @@
|
||||
" Author: Matthias Guenther - https://wikimatze.de, Eddie Lebow https://github.com/elebow
|
||||
" Description: ERB from the Ruby standard library, for eruby/erb files
|
||||
|
||||
function! ale_linters#eruby#erb#GetCommand(buffer) abort
|
||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||
|
||||
if empty(l:rails_root)
|
||||
return 'erb -P -T - -x %t | ruby -c'
|
||||
endif
|
||||
|
||||
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||
" ERB, so we'll have to do some substitution. This does not reduce the
|
||||
" effectiveness of the linter—the translated code is still evaluated.
|
||||
return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'erb',
|
||||
\ 'aliases': ['erubylint'],
|
||||
\ 'executable': 'erb',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': function('ale_linters#eruby#erb#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
||||
|
@ -1,51 +0,0 @@
|
||||
" Author: Roeland Moors - https://github.com/roelandmoors
|
||||
" based on the ale ruumba and robocop linters
|
||||
" Description: ERB Lint, support for https://github.com/Shopify/erb-lint
|
||||
|
||||
call ale#Set('eruby_erblint_executable', 'erblint')
|
||||
call ale#Set('eruby_erblint_options', '')
|
||||
|
||||
function! ale_linters#eruby#erblint#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'eruby_erblint_executable')
|
||||
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'erblint')
|
||||
\ . ' --format json '
|
||||
\ . ale#Var(a:buffer, 'eruby_erblint_options')
|
||||
\ . ' --stdin %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#eruby#erblint#Handle(buffer, lines) abort
|
||||
if empty(a:lines)
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], [])
|
||||
|
||||
if !has_key(l:errors, 'summary')
|
||||
\|| l:errors['summary']['offenses'] == 0
|
||||
\|| empty(l:errors['files'])
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors['files'][0]['offenses']
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error['location']['start_line'] + 0,
|
||||
\ 'col': l:error['location']['start_column'] + 0,
|
||||
\ 'end_col': l:error['location']['last_column'] + 0,
|
||||
\ 'code': l:error['linter'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'erblint',
|
||||
\ 'executable': {b -> ale#Var(b, 'eruby_erblint_executable')},
|
||||
\ 'command': function('ale_linters#eruby#erblint#GetCommand'),
|
||||
\ 'callback': 'ale_linters#eruby#erblint#Handle',
|
||||
\})
|
@ -1,32 +0,0 @@
|
||||
" Author: Eddie Lebow https://github.com/elebow
|
||||
" Description: eruby checker using `erubi`
|
||||
|
||||
function! ale_linters#eruby#erubi#GetCommand(buffer, output, meta) abort
|
||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||
|
||||
if !empty(a:output)
|
||||
" The empty command in CheckErubi returns nothing if erubi runs and
|
||||
" emits an error if erubi is not present
|
||||
return ''
|
||||
endif
|
||||
|
||||
if empty(l:rails_root)
|
||||
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read).src') . '< %t | ruby -c'
|
||||
endif
|
||||
|
||||
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||
" Erubi, so we'll have to do some substitution. This does not reduce the
|
||||
" effectiveness of the linter---the translated code is still evaluated.
|
||||
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'erubi',
|
||||
\ 'executable': 'ruby',
|
||||
\ 'command': {buffer -> ale#command#Run(
|
||||
\ buffer,
|
||||
\ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'),
|
||||
\ function('ale_linters#eruby#erubi#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
@ -1,23 +0,0 @@
|
||||
" Author: Jake Zimmerman <jake@zimmerman.io>, Eddie Lebow https://github.com/elebow
|
||||
" Description: eruby checker using `erubis`, instead of `erb`
|
||||
|
||||
function! ale_linters#eruby#erubis#GetCommand(buffer) abort
|
||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||
|
||||
if empty(l:rails_root)
|
||||
return 'erubis -x %t | ruby -c'
|
||||
endif
|
||||
|
||||
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||
" Erubis, so we'll have to do some substitution. This does not reduce the
|
||||
" effectiveness of the linter - the translated code is still evaluated.
|
||||
return 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . '< %t | ruby -c'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'erubis',
|
||||
\ 'executable': 'erubis',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': function('ale_linters#eruby#erubis#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
@ -1,62 +0,0 @@
|
||||
" Author: aclemons - https://github.com/aclemons
|
||||
" based on the ale rubocop linter
|
||||
" Description: Ruumba, RuboCop linting for ERB templates.
|
||||
|
||||
call ale#Set('eruby_ruumba_executable', 'ruumba')
|
||||
call ale#Set('eruby_ruumba_options', '')
|
||||
|
||||
function! ale_linters#eruby#ruumba#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'eruby_ruumba_executable')
|
||||
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'ruumba')
|
||||
\ . ' --format json --force-exclusion '
|
||||
\ . ale#Var(a:buffer, 'eruby_ruumba_options')
|
||||
\ . ' --stdin %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort
|
||||
try
|
||||
let l:errors = json_decode(a:lines[0])
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
|
||||
if !has_key(l:errors, 'summary')
|
||||
\|| l:errors['summary']['offense_count'] == 0
|
||||
\|| empty(l:errors['files'])
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors['files'][0]['offenses']
|
||||
let l:start_col = l:error['location']['column'] + 0
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error['location']['line'] + 0,
|
||||
\ 'col': l:start_col,
|
||||
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
|
||||
\ 'code': l:error['cop_name'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': ale_linters#eruby#ruumba#GetType(l:error['severity']),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#eruby#ruumba#GetType(severity) abort
|
||||
if a:severity is? 'convention'
|
||||
\|| a:severity is? 'warning'
|
||||
\|| a:severity is? 'refactor'
|
||||
return 'W'
|
||||
endif
|
||||
|
||||
return 'E'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'ruumba',
|
||||
\ 'executable': {b -> ale#Var(b, 'eruby_ruumba_executable')},
|
||||
\ 'command': function('ale_linters#eruby#ruumba#GetCommand'),
|
||||
\ 'callback': 'ale_linters#eruby#ruumba#Handle',
|
||||
\})
|
Reference in New Issue
Block a user