mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Forgot to add the newly created files from the plugin update
This commit is contained in:
54
sources_non_forked/ale/ale_linters/ada/gcc.vim
Normal file
54
sources_non_forked/ale/ale_linters/ada/gcc.vim
Normal file
@ -0,0 +1,54 @@
|
||||
" Author: Martino Pilia <martino.pilia@gmail.com>
|
||||
" Description: Lint Ada files with GCC
|
||||
|
||||
call ale#Set('ada_gcc_executable', 'gcc')
|
||||
|
||||
" -gnatwa: activate most optional warnings
|
||||
" -gnatq: try semantic analysis even if syntax errors have been found
|
||||
call ale#Set('ada_gcc_options', '-gnatwa -gnatq')
|
||||
|
||||
function! ale_linters#ada#gcc#GetCommand(buffer) abort
|
||||
" Build a suitable output file name. The output file is specified because
|
||||
" the .ali file may be created even if no code generation is attempted.
|
||||
" The output file name must match the source file name (except for the
|
||||
" extension), so here we cannot use the null file as output.
|
||||
let l:tmp_dir = fnamemodify(ale#engine#CreateDirectory(a:buffer), ':p')
|
||||
let l:out_file = l:tmp_dir . fnamemodify(bufname(a:buffer), ':t:r') . '.o'
|
||||
|
||||
" -gnatc: Check syntax and semantics only (no code generation attempted)
|
||||
return '%e -x ada -c -gnatc'
|
||||
\ . ' -o ' . ale#Escape(l:out_file)
|
||||
\ . ' -I ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options'))
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
" For the message format please refer to:
|
||||
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Output-and-Error-Message-Control.html
|
||||
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Warning-Message-Control.html
|
||||
function! ale_linters#ada#gcc#Handle(buffer, lines) abort
|
||||
" Error format: <filename>:<lnum>:<col>: <text>
|
||||
" Warning format: <filename>:<lnum>:<col>: warning: <text>
|
||||
let l:re = '\v(.+):([0-9]+):([0-9]+):\s+(warning:)?\s*(.+)\s*'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:re)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'col': str2nr(l:match[3]),
|
||||
\ 'type': l:match[4] is# 'warning:' ? 'W' : 'E',
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ada', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': ale#VarFunc('ada_gcc_executable'),
|
||||
\ 'command_callback': 'ale_linters#ada#gcc#GetCommand',
|
||||
\ 'callback': 'ale_linters#ada#gcc#Handle',
|
||||
\})
|
9
sources_non_forked/ale/ale_linters/asciidoc/vale.vim
Normal file
9
sources_non_forked/ale/ale_linters/asciidoc/vale.vim
Normal file
@ -0,0 +1,9 @@
|
||||
" Author: Jeff Kreeftmeijer https://github.com/jeffkreeftmeijer
|
||||
" Description: vale for AsciiDoc files
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=line %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
74
sources_non_forked/ale/ale_linters/bib/bibclean.vim
Normal file
74
sources_non_forked/ale/ale_linters/bib/bibclean.vim
Normal file
@ -0,0 +1,74 @@
|
||||
" Author: Horacio Sanson - https://github.com/hsanson
|
||||
" Description: Support for bibclean linter for BibTeX files.
|
||||
|
||||
call ale#Set('bib_bibclean_executable', 'bibclean')
|
||||
|
||||
function! ale_linters#bib#bibclean#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'bib_bibclean_executable')
|
||||
|
||||
return ale#Escape(l:executable) . ' -file-position '
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#get_type(str) abort
|
||||
if a:str is# '??'
|
||||
return 'E'
|
||||
else
|
||||
return 'W'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#match_msg(line) abort
|
||||
return matchlist(a:line, '^\(.*\) "stdin", line \(.*\): \(.*\)$')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#match_entry(line) abort
|
||||
return matchlist(a:line, 'Entry input byte=.* line=\(.*\) column=\(.*\) output .*$')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#match_value(line) abort
|
||||
return matchlist(a:line, 'Value input byte=.* line=\(.*\) column=\(.*\) output .*$')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
let l:type = 'E'
|
||||
let l:msg = ''
|
||||
|
||||
for l:line in a:lines
|
||||
if empty(l:msg)
|
||||
let l:mlist = ale_linters#bib#bibclean#match_msg(l:line)
|
||||
|
||||
if !empty(l:mlist)
|
||||
let l:msg = l:mlist[3]
|
||||
let l:type = ale_linters#bib#bibclean#get_type(l:mlist[1])
|
||||
endif
|
||||
else
|
||||
if l:type is# 'E'
|
||||
let l:mlist = ale_linters#bib#bibclean#match_entry(l:line)
|
||||
else
|
||||
let l:mlist = ale_linters#bib#bibclean#match_value(l:line)
|
||||
endif
|
||||
|
||||
if !empty(l:mlist)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:mlist[1],
|
||||
\ 'col': l:mlist[2],
|
||||
\ 'text': l:msg,
|
||||
\ 'type': l:type
|
||||
\})
|
||||
let l:msg = ''
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bib', {
|
||||
\ 'name': 'bibclean',
|
||||
\ 'executable_callback': ale#VarFunc('bib_bibclean_executable'),
|
||||
\ 'command_callback': 'ale_linters#bib#bibclean#GetCommand',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#bib#bibclean#Handle',
|
||||
\})
|
62
sources_non_forked/ale/ale_linters/eruby/ruumba.vim
Normal file
62
sources_non_forked/ale/ale_linters/eruby/ruumba.vim
Normal file
@ -0,0 +1,62 @@
|
||||
" 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#handlers#ruby#EscapeExecutable(l:executable, 'ruumba')
|
||||
\ . ' --format json --force-exclusion '
|
||||
\ . ale#Var(a:buffer, 'eruby_ruumba_options')
|
||||
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
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_callback': ale#VarFunc('eruby_ruumba_executable'),
|
||||
\ 'command_callback': 'ale_linters#eruby#ruumba#GetCommand',
|
||||
\ 'callback': 'ale_linters#eruby#ruumba#Handle',
|
||||
\})
|
45
sources_non_forked/ale/ale_linters/ispc/ispc.vim
Normal file
45
sources_non_forked/ale/ale_linters/ispc/ispc.vim
Normal file
@ -0,0 +1,45 @@
|
||||
" Author: Martino Pilia <martino.pilia@gmail.com>
|
||||
" Description: Lint ispc files with the Intel(R) SPMD Program Compiler
|
||||
|
||||
call ale#Set('ispc_ispc_executable', 'ispc')
|
||||
call ale#Set('ispc_ispc_options', '')
|
||||
|
||||
function! ale_linters#ispc#ispc#GetCommand(buffer) abort
|
||||
" --nowrap: do not wrap message lines
|
||||
return '%e --nowrap'
|
||||
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'ispc_ispc_options'))
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
" Note that we ignore the two warnings in the beginning of the compiler output
|
||||
" ('no output file specified' and 'no --target specified'), since they have
|
||||
" nothing to do with linting.
|
||||
function! ale_linters#ispc#ispc#Handle(buffer, lines) abort
|
||||
" Message format: <filename>:<lnum>:<col> <type>: <text>
|
||||
" As far as I know, <type> can be any of:
|
||||
" 'error', 'Error', 'fatal error', 'Warning', 'Performance Warning'
|
||||
let l:re = '\v.+:([0-9]+):([0-9]+):\s+([^:]+):\s+(.+)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:re)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'type': l:match[3] =~? 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ispc', {
|
||||
\ 'name': 'ispc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': ale#VarFunc('ispc_ispc_executable'),
|
||||
\ 'command_callback': 'ale_linters#ispc#ispc#GetCommand',
|
||||
\ 'callback': 'ale_linters#ispc#ispc#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
74
sources_non_forked/ale/ale_linters/python/pydocstyle.vim
Normal file
74
sources_non_forked/ale/ale_linters/python/pydocstyle.vim
Normal file
@ -0,0 +1,74 @@
|
||||
" Author: Pablo Acosta <pmasdev@gmail.com>
|
||||
" Description: pydocstyle for python files
|
||||
|
||||
call ale#Set('python_pydocstyle_executable', 'pydocstyle')
|
||||
call ale#Set('python_pydocstyle_options', '')
|
||||
call ale#Set('python_pydocstyle_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pydocstyle_auto_pipenv', 0)
|
||||
|
||||
function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pydocstyle_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pydocstyle', ['pydocstyle'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pydocstyle#GetCommand(buffer) abort
|
||||
let l:dir = fnamemodify(bufname(a:buffer), ':p:h')
|
||||
let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
\ ? ' run pydocstyle'
|
||||
\ : ''
|
||||
|
||||
return ale#path#CdString(l:dir)
|
||||
\ . ale#Escape(l:executable) . l:exec_args
|
||||
\ . ' ' . ale#Var(a:buffer, 'python_pydocstyle_options')
|
||||
\ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:t'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" mydir/myfile.py:33 in public function `myfunction`:
|
||||
" DXXX: Error description
|
||||
let l:fname = ale#Escape(fnamemodify(bufname(a:buffer), ':p:t'))
|
||||
let l:line1_pattern = '\v^' . l:fname . ':\s*(\d+)\s+.*$'
|
||||
let l:line2_pattern = '\v^.*([a-zA-Z]\d+):\s*(.*)$'
|
||||
let l:output = []
|
||||
|
||||
let l:num_lines = len(a:lines)
|
||||
let l:index = 0
|
||||
|
||||
while l:index < l:num_lines
|
||||
let l:lnum = matchlist(a:lines[l:index], l:line1_pattern)
|
||||
|
||||
if !empty(l:lnum) && (l:index + 1 < l:num_lines)
|
||||
let l:desc = matchlist(a:lines[l:index + 1], l:line2_pattern)
|
||||
|
||||
if !empty(l:desc)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:lnum[1] + 0,
|
||||
\ 'col': 1,
|
||||
\ 'type': 'W',
|
||||
\ 'text': l:desc[2],
|
||||
\ 'code': l:desc[1],
|
||||
\})
|
||||
endif
|
||||
|
||||
let l:index = l:index + 2
|
||||
else
|
||||
let l:index = l:index + 1
|
||||
endif
|
||||
endwhile
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pydocstyle',
|
||||
\ 'executable_callback': 'ale_linters#python#pydocstyle#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pydocstyle#GetCommand',
|
||||
\ 'callback': 'ale_linters#python#pydocstyle#Handle',
|
||||
\})
|
23
sources_non_forked/ale/ale_linters/ruby/standardrb.vim
Normal file
23
sources_non_forked/ale/ale_linters/ruby/standardrb.vim
Normal file
@ -0,0 +1,23 @@
|
||||
" Author: Justin Searls https://github.com/searls, ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow
|
||||
" based on the ale rubocop linter
|
||||
" Description: StandardRB - Ruby Style Guide, with linter & automatic code fixer
|
||||
|
||||
call ale#Set('ruby_standardrb_executable', 'standardrb')
|
||||
call ale#Set('ruby_standardrb_options', '')
|
||||
|
||||
function! ale_linters#ruby#standardrb#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_standardrb_executable')
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'standardrb')
|
||||
\ . ' --format json --force-exclusion '
|
||||
\ . ale#Var(a:buffer, 'ruby_standardrb_options')
|
||||
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
endfunction
|
||||
|
||||
" standardrb is based on RuboCop so the callback is the same
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'standardrb',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_standardrb_executable'),
|
||||
\ 'command_callback': 'ale_linters#ruby#standardrb#GetCommand',
|
||||
\ 'callback': 'ale#ruby#HandleRubocopOutput',
|
||||
\})
|
Reference in New Issue
Block a user