mirror of
https://github.com/amix/vimrc
synced 2025-08-30 02:44:59 +08:00
Updated plugins
This commit is contained in:
@ -29,10 +29,20 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
|
||||
|
||||
for l:issue in l:linter_issues
|
||||
if ale#path#IsBufferPath(a:buffer, l:issue.location.path)
|
||||
if exists('l:issue.location.positions')
|
||||
let l:coord_keyname = 'positions'
|
||||
else
|
||||
let l:coord_keyname = 'lines'
|
||||
endif
|
||||
|
||||
let l:column_member = printf(
|
||||
\ 'l:issue.location.%s.begin.column', l:coord_keyname
|
||||
\)
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.line :
|
||||
\ l:issue.location.lines.begin,
|
||||
\ 'col': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.column : 0,
|
||||
\ 'lnum': exists(l:column_member) ? l:issue.location[l:coord_keyname].begin.line :
|
||||
\ l:issue.location[l:coord_keyname].begin,
|
||||
\ 'col': exists(l:column_member) ? l:issue.location[l:coord_keyname].begin.column : 0,
|
||||
\ 'text': l:issue.check_name,
|
||||
\ 'detail': l:issue.description,
|
||||
\ 'code': l:issue.severity,
|
||||
|
69
sources_non_forked/ale/ale_linters/bicep/az_bicep.vim
Normal file
69
sources_non_forked/ale/ale_linters/bicep/az_bicep.vim
Normal file
@ -0,0 +1,69 @@
|
||||
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
|
||||
" Description: az_bicep for bicep files
|
||||
|
||||
let g:ale_bicep_az_bicep_executable =
|
||||
\ get(g:, 'ale_bicep_az_bicep_executable', 'az')
|
||||
|
||||
let g:ale_bicep_az_bicep_options =
|
||||
\ get(g:, 'ale_bicep_az_bicep_options', '')
|
||||
|
||||
function! ale_linters#bicep#az_bicep#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'bicep_az_bicep_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#az_bicep#Command(buffer) abort
|
||||
let l:executable = ale_linters#bicep#az_bicep#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'bicep_az_bicep_options')
|
||||
|
||||
if has('win32')
|
||||
let l:nullfile = 'NUL'
|
||||
else
|
||||
let l:nullfile = '/dev/null'
|
||||
endif
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' bicep build --outfile '
|
||||
\ . l:nullfile
|
||||
\ . ' --file '
|
||||
\ . '%s '
|
||||
\ . l:options
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#az_bicep#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([A-Z]+)?(:\s)?(.*)\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:match[1] is# 'ERROR'
|
||||
let l:type = 'E'
|
||||
elseif l:match[1] is# 'WARNING'
|
||||
let l:type = 'W'
|
||||
elseif l:match[6] is# 'Error'
|
||||
let l:type = 'E'
|
||||
elseif l:match[6] is# 'Warning'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'I'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'filename': l:match[3],
|
||||
\ 'lnum': l:match[4] + 0,
|
||||
\ 'col': l:match[5] + 0,
|
||||
\ 'type': l:type,
|
||||
\ 'code': l:match[7],
|
||||
\ 'text': l:match[8],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bicep', {
|
||||
\ 'name': 'az_bicep',
|
||||
\ 'executable': function('ale_linters#bicep#az_bicep#Executable'),
|
||||
\ 'command': function('ale_linters#bicep#az_bicep#Command'),
|
||||
\ 'callback': 'ale_linters#bicep#az_bicep#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
@ -30,24 +30,25 @@ function! ale_linters#bicep#bicep#Command(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#bicep#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^.*\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
|
||||
let l:pattern = '\v^(.*)\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:match[3] is# 'Error'
|
||||
if l:match[4] is# 'Error'
|
||||
let l:type = 'E'
|
||||
elseif l:match[3] is# 'Warning'
|
||||
elseif l:match[4] is# 'Warning'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'I'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'filename': l:match[1],
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:type,
|
||||
\ 'code': l:match[4],
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6],
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
40
sources_non_forked/ale/ale_linters/bzl/buildifier.vim
Normal file
40
sources_non_forked/ale/ale_linters/bzl/buildifier.vim
Normal file
@ -0,0 +1,40 @@
|
||||
" Author: Chuck Grindel <chuck.grindel@gmail.com>
|
||||
" Description: Bazel Starlark lint support using buildifier.
|
||||
|
||||
function! ale_linters#bzl#buildifier#GetCommand(buffer) abort
|
||||
let l:executable = ale#Escape(ale#fixers#buildifier#GetExecutable(a:buffer))
|
||||
let l:options = ale#Var(a:buffer, 'bazel_buildifier_options')
|
||||
let l:filename = ale#Escape(bufname(a:buffer))
|
||||
|
||||
let l:command = l:executable . ' -mode check -lint warn -path %s'
|
||||
|
||||
if l:options isnot# ''
|
||||
let l:command .= ' ' . l:options
|
||||
endif
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bzl#buildifier#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^[^:]+:(\d+):(\d+)?:?\s+(syntax error near)?(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3] . l:match[4],
|
||||
\ 'type': l:match[3] is# 'syntax error near' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bzl', {
|
||||
\ 'name': 'buildifier',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#fixers#buildifier#GetExecutable'),
|
||||
\ 'command': function('ale_linters#bzl#buildifier#GetCommand'),
|
||||
\ 'callback': function('ale_linters#bzl#buildifier#Handle'),
|
||||
\})
|
54
sources_non_forked/ale/ale_linters/cairo/sierra.vim
Normal file
54
sources_non_forked/ale/ale_linters/cairo/sierra.vim
Normal file
@ -0,0 +1,54 @@
|
||||
" Author: 0xHyoga <0xHyoga@gmx.com>
|
||||
" Description: Report Starknet compile to sierra errors in cairo 1.0 code
|
||||
|
||||
call ale#Set('cairo_sierra_executable', 'starknet-compile')
|
||||
call ale#Set('cairo_sierra_options', '')
|
||||
|
||||
function! ale_linters#cairo#sierra#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" Error: Expected ';' but got '('
|
||||
" --> /path/to/file/file.cairo:1:10:)
|
||||
let l:pattern = '\v(error|warning): (.*)$'
|
||||
let l:line_and_column_pattern = '\v\.cairo:(\d+):(\d+)'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
let l:match = matchlist(l:line, l:line_and_column_pattern)
|
||||
|
||||
if len(l:match) > 0
|
||||
let l:index = len(l:output) - 1
|
||||
let l:output[l:index]['lnum'] = l:match[1] + 0
|
||||
let l:output[l:index]['col'] = l:match[2] + 0
|
||||
endif
|
||||
else
|
||||
let l:isError = l:match[1] is? 'Error'
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'type': l:isError ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cairo#sierra#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'cairo_sierra_executable')
|
||||
|
||||
return l:executable . ale#Pad(ale#Var(a:buffer, 'cairo_sierra_options')) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cairo', {
|
||||
\ 'name': 'sierra',
|
||||
\ 'executable': {b -> ale#Var(b, 'cairo_sierra_executable')},
|
||||
\ 'command': function('ale_linters#cairo#sierra#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cairo#sierra#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
||||
|
@ -1,5 +1,6 @@
|
||||
" Author: 0xHyoga <0xHyoga@gmx.com>
|
||||
" Description: Report starknet-compile errors in cairo code
|
||||
" Description: Report starknet-compile errors in cairo code (pre-starknet
|
||||
" 1.0). This is deprecated but kept for backwards compatability.
|
||||
|
||||
call ale#Set('cairo_starknet_executable', 'starknet-compile')
|
||||
call ale#Set('cairo_starknet_options', '')
|
||||
@ -35,3 +36,4 @@ call ale#linter#Define('cairo', {
|
||||
\ 'callback': 'ale_linters#cairo#starknet#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
||||
|
||||
|
@ -0,0 +1,69 @@
|
||||
" Author: Shad
|
||||
" Description: dockerlinter linter for dockerfile
|
||||
|
||||
call ale#Set('dockerfile_dockerlinter_executable', 'dockerlinter')
|
||||
call ale#Set('dockerfile_dockerlinter_options', '')
|
||||
|
||||
function! ale_linters#dockerfile#dockerlinter#GetType(type) abort
|
||||
if a:type is? 'error'
|
||||
return 'E'
|
||||
elseif a:type is? 'warning'
|
||||
return 'W'
|
||||
endif
|
||||
|
||||
return 'I'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dockerfile#dockerlinter#Handle(buffer, lines) abort
|
||||
try
|
||||
let l:data = json_decode(join(a:lines, ''))
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
|
||||
if empty(l:data)
|
||||
" Should never happen, but it's better to be on the safe side
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:messages = []
|
||||
|
||||
for l:object in l:data
|
||||
let l:line = get(l:object, 'lineNumber', -1)
|
||||
let l:message = l:object['message']
|
||||
let l:type = l:object['level']
|
||||
let l:detail = l:message
|
||||
let l:code = l:object['code']
|
||||
|
||||
if l:code =~# '^SC'
|
||||
let l:link = 'https://www.shellcheck.net/wiki/' . l:code
|
||||
else
|
||||
let l:link = 'https://github.com/buddy-works/dockerfile-linter/blob/master/Rules.md#' . l:code
|
||||
endif
|
||||
|
||||
let l:detail = l:message . "\n\n" . l:link
|
||||
|
||||
call add(l:messages, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'code': l:code,
|
||||
\ 'text': l:message,
|
||||
\ 'type': ale_linters#dockerfile#dockerlinter#GetType(l:type),
|
||||
\ 'detail': l:detail,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:messages
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dockerfile#dockerlinter#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'dockerfile_dockerlinter_options'))
|
||||
\ . ' -j -f'
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dockerfile', {
|
||||
\ 'name': 'dockerlinter',
|
||||
\ 'executable': {b -> ale#Var(b, 'dockerfile_dockerlinter_executable')},
|
||||
\ 'command': function('ale_linters#dockerfile#dockerlinter#GetCommand'),
|
||||
\ 'callback': 'ale_linters#dockerfile#dockerlinter#Handle',
|
||||
\})
|
@ -11,7 +11,7 @@ function! ale_linters#eruby#erb#GetCommand(buffer) abort
|
||||
" 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'
|
||||
return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), trim_mode: %{-}).src') . '< %t | ruby -c'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Author: Sascha Grunert <mail@saschagrunert.de>
|
||||
" Description: Adds support of golangci-lint
|
||||
|
||||
call ale#Set('go_golangci_lint_options', '--enable-all')
|
||||
call ale#Set('go_golangci_lint_options', '')
|
||||
call ale#Set('go_golangci_lint_executable', 'golangci-lint')
|
||||
call ale#Set('go_golangci_lint_package', 0)
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
" Author: neersighted <bjorn@neersighted.com>
|
||||
" Description: golint for Go files
|
||||
|
||||
call ale#Set('go_golint_executable', 'golint')
|
||||
call ale#Set('go_golint_options', '')
|
||||
|
||||
function! ale_linters#go#golint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_golint_options')
|
||||
|
||||
return ale#go#EnvString(a:buffer) . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'golint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_golint_executable')},
|
||||
\ 'command': function('ale_linters#go#golint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
46
sources_non_forked/ale/ale_linters/groovy/npmgroovylint.vim
Normal file
46
sources_non_forked/ale/ale_linters/groovy/npmgroovylint.vim
Normal file
@ -0,0 +1,46 @@
|
||||
" Author: lucas-str <lucas.sturelle@ik.me>
|
||||
" Description: Integration of npm-groovy-lint for Groovy files.
|
||||
|
||||
call ale#Set('groovy_npmgroovylint_executable', 'npm-groovy-lint')
|
||||
call ale#Set('groovy_npmgroovylint_options', '--loglevel warning')
|
||||
|
||||
function! ale_linters#groovy#npmgroovylint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_options')
|
||||
|
||||
return '%e --failon none --output json'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#groovy#npmgroovylint#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
|
||||
|
||||
for [l:filename, l:file] in items(get(l:json, 'files', {}))
|
||||
for l:error in get(l:file, 'errors', [])
|
||||
let l:output_line = {
|
||||
\ 'filename': l:filename,
|
||||
\ 'lnum': l:error.line,
|
||||
\ 'text': l:error.msg,
|
||||
\ 'type': toupper(l:error.severity[0]),
|
||||
\}
|
||||
|
||||
if has_key(l:error, 'range')
|
||||
let l:output_line.col = l:error.range.start.character
|
||||
let l:output_line.end_col = l:error.range.end.character
|
||||
let l:output_line.end_lnum = l:error.range.end.line
|
||||
endif
|
||||
|
||||
call add(l:output, l:output_line)
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('groovy', {
|
||||
\ 'name': 'npm-groovy-lint',
|
||||
\ 'executable': {b -> ale#Var(b, 'groovy_npmgroovylint_executable')},
|
||||
\ 'command': function('ale_linters#groovy#npmgroovylint#GetCommand'),
|
||||
\ 'callback': 'ale_linters#groovy#npmgroovylint#Handle',
|
||||
\})
|
@ -65,7 +65,7 @@ endfunction
|
||||
function! ale_linters#python#pyright#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pyright#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
\ ? ' run pyright'
|
||||
\ ? ' run pyright-langserver'
|
||||
\ : ''
|
||||
let l:env_string = ''
|
||||
|
||||
|
Reference in New Issue
Block a user