mirror of
https://github.com/amix/vimrc
synced 2025-08-30 02:44:59 +08:00
Updated plugins
This commit is contained in:
@ -18,9 +18,30 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
|
||||
endif
|
||||
endfor
|
||||
|
||||
let l:version_group = ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : '<5.0.0'
|
||||
let l:version_group = ale#semver#GTE(a:version, [6, 0, 0]) ? '>=6.0.0' :
|
||||
\ ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' :
|
||||
\ '<5.0.0'
|
||||
let l:output = []
|
||||
|
||||
if '>=6.0.0' is# l:version_group
|
||||
let l:error_codes = { 'blocker': 'E', 'critical': 'E', 'major': 'W', 'minor': 'W', 'info': 'I' }
|
||||
let l:linter_issues = json_decode(join(a:lines, ''))
|
||||
|
||||
for l:issue in l:linter_issues
|
||||
if ale#path#IsBufferPath(a:buffer, l:issue.location.path)
|
||||
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,
|
||||
\ 'text': l:issue.check_name,
|
||||
\ 'detail': l:issue.description,
|
||||
\ 'code': l:issue.severity,
|
||||
\ 'type': l:error_codes[l:issue.severity],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if '>=5.0.0' is# l:version_group
|
||||
" Matches patterns line the following:
|
||||
" test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play
|
||||
@ -73,10 +94,13 @@ endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
|
||||
let l:commands = {
|
||||
\ '>=6.0.0': '%e --nocolor -f json -x yaml %s',
|
||||
\ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s',
|
||||
\ '<5.0.0': '%e --nocolor -p %t'
|
||||
\}
|
||||
let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0']
|
||||
let l:command = ale#semver#GTE(a:version, [6, 0]) ? l:commands['>=6.0.0'] :
|
||||
\ ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] :
|
||||
\ l:commands['<5.0.0']
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
@ -9,8 +9,9 @@ function! ale_linters#awk#gawk#GetCommand(buffer) abort
|
||||
" gawk from attempting to execute the body of the script
|
||||
" it is linting.
|
||||
return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
|
||||
\ . ' --lint'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options'))
|
||||
\ . ' -f %t --lint /dev/null'
|
||||
\ . ' -f %t /dev/null'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('awk', {
|
||||
|
@ -4,15 +4,16 @@
|
||||
call ale#Set('dart_analyze_executable', 'dart')
|
||||
|
||||
function! ale_linters#dart#dart_analyze#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^ ([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$'
|
||||
let l:pattern = '\v([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let [l:type, l:filename, l:lnum, l:col, l:message, l:code] = l:match[1:6]
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[6] . ': ' . l:match[5],
|
||||
\ 'lnum': str2nr(l:match[3]),
|
||||
\ 'col': str2nr(l:match[4]),
|
||||
\ 'type': l:type is# 'error' ? 'E' : l:type is# 'info' ? 'I' : 'W',
|
||||
\ 'text': l:code . ': ' . l:message,
|
||||
\ 'lnum': str2nr(l:lnum),
|
||||
\ 'col': str2nr(l:col),
|
||||
\})
|
||||
endfor
|
||||
|
||||
@ -22,7 +23,7 @@ endfunction
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'dart_analyze',
|
||||
\ 'executable': {b -> ale#Var(b, 'dart_analyze_executable')},
|
||||
\ 'command': '%e analyze %s',
|
||||
\ 'command': '%e analyze --fatal-infos %s',
|
||||
\ 'callback': 'ale_linters#dart#dart_analyze#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
@ -1,36 +0,0 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Check Dart files with dartanalyzer
|
||||
|
||||
call ale#Set('dart_dartanalyzer_executable', 'dartanalyzer')
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort
|
||||
let l:path = ale#path#FindNearestFile(a:buffer, '.packages')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^ ([a-z]+) . (.+) at (.+):(\d+):(\d+) . (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[6] . ': ' . l:match[2],
|
||||
\ 'lnum': str2nr(l:match[4]),
|
||||
\ 'col': str2nr(l:match[5]),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'dartanalyzer',
|
||||
\ 'executable': {b -> ale#Var(b, 'dart_dartanalyzer_executable')},
|
||||
\ 'command': function('ale_linters#dart#dartanalyzer#GetCommand'),
|
||||
\ 'callback': 'ale_linters#dart#dartanalyzer#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
@ -12,6 +12,7 @@ function! ale_linters#erlang#elvis#Handle(buffer, lines) abort
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'text': s:AbbreviateMessage(l:match[2]),
|
||||
\ 'type': 'W',
|
||||
\ 'sub_type': 'style',
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
@ -24,7 +24,7 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#golangci_lint#GetMatches(lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)$'
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)\s+\((.+)\)$'
|
||||
|
||||
return ale#util#GetMatches(a:lines, l:pattern)
|
||||
endfunction
|
||||
@ -34,14 +34,20 @@ function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines)
|
||||
if l:match[5] is# 'typecheck'
|
||||
let l:msg_type = 'E'
|
||||
else
|
||||
let l:msg_type = 'W'
|
||||
endif
|
||||
|
||||
" l:match[1] will already be an absolute path, output from
|
||||
" golangci_lint
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': l:msg_type,
|
||||
\ 'text': l:match[4] . ' (' . l:match[5] . ')',
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
@ -11,10 +11,17 @@ function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort
|
||||
" Reading from stdin was introduced in ember-template-lint@1.6.0
|
||||
return ale#semver#GTE(a:version, [1, 6, 0])
|
||||
\ ? '%e --json --filename %s'
|
||||
\ : '%e --json %t'
|
||||
if ale#semver#GTE(a:version, [4, 0, 0])
|
||||
" --json was removed in favor of --format=json in ember-template-lint@4.0.0
|
||||
return '%e --format=json --filename %s'
|
||||
endif
|
||||
|
||||
if ale#semver#GTE(a:version, [1, 6, 0])
|
||||
" Reading from stdin was introduced in ember-template-lint@1.6.0
|
||||
return '%e --json --filename %s'
|
||||
endif
|
||||
|
||||
return '%e --json %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort
|
||||
|
@ -4,6 +4,7 @@
|
||||
" <devildead13@gmail.com>). It search more project root files.
|
||||
"
|
||||
call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper')
|
||||
call ale#Set('haskell_hls_config', {})
|
||||
|
||||
function! ale_linters#haskell#hls#FindRootFile(buffer) abort
|
||||
let l:serach_root_files = [
|
||||
@ -60,4 +61,5 @@ call ale#linter#Define('haskell', {
|
||||
\ 'command': function('ale_linters#haskell#hls#GetCommand'),
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_hls_executable')},
|
||||
\ 'project_root': function('ale_linters#haskell#hls#GetProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'haskell_hls_config')},
|
||||
\})
|
||||
|
@ -11,10 +11,7 @@ function! ale_linters#html#angular#GetProjectRoot(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#angular#GetExecutable(buffer) abort
|
||||
return ale#path#FindExecutable(a:buffer, 'html_angular', [
|
||||
\ 'node_modules/@angular/language-server/bin/ngserver',
|
||||
\ 'node_modules/@angular/language-server/index.js',
|
||||
\])
|
||||
return 'node'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#angular#GetCommand(buffer) abort
|
||||
@ -34,9 +31,16 @@ function! ale_linters#html#angular#GetCommand(buffer) abort
|
||||
\ fnamemodify(l:language_service_dir, ':h:h')
|
||||
\ . '/typescript'
|
||||
\)
|
||||
let l:executable = ale_linters#html#angular#GetExecutable(a:buffer)
|
||||
let l:script = ale#path#FindExecutable(a:buffer, 'html_angular', [
|
||||
\ 'node_modules/@angular/language-server/bin/ngserver',
|
||||
\ 'node_modules/@angular/language-server/index.js',
|
||||
\])
|
||||
|
||||
return ale#node#Executable(a:buffer, l:executable)
|
||||
if !filereadable(l:script)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#Escape('node') . ' ' . ale#Escape(l:script)
|
||||
\ . ' --ngProbeLocations ' . ale#Escape(l:language_service_dir)
|
||||
\ . ' --tsProbeLocations ' . ale#Escape(l:typescript_dir)
|
||||
\ . ' --stdio'
|
||||
|
@ -192,4 +192,9 @@ call ale#linter#Define('java', {
|
||||
\ 'command': function('ale_linters#java#eclipselsp#RunWithVersionCheck'),
|
||||
\ 'language': 'java',
|
||||
\ 'project_root': function('ale#java#FindProjectRoot'),
|
||||
\ 'initialization_options': {
|
||||
\ 'extendedClientCapabilities': {
|
||||
\ 'classFileContentsSupport': v:true
|
||||
\ }
|
||||
\ }
|
||||
\})
|
||||
|
@ -20,6 +20,6 @@ endfunction
|
||||
call ale#linter#Define('make', {
|
||||
\ 'name': 'checkmake',
|
||||
\ 'executable': 'checkmake',
|
||||
\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}"',
|
||||
\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"',
|
||||
\ 'callback': 'ale_linters#make#checkmake#Handle',
|
||||
\})
|
||||
|
@ -5,7 +5,7 @@
|
||||
function! ale_linters#nix#nix#Command(buffer, output, meta) abort
|
||||
let l:version = a:output[0][22:]
|
||||
|
||||
if l:version =~# '^\(2.4\|3\).*'
|
||||
if l:version =~# '^\(2.[4-9]\|3\).*'
|
||||
return 'nix-instantiate --log-format internal-json --parse -'
|
||||
else
|
||||
return 'nix-instantiate --parse -'
|
||||
|
@ -1,4 +1,4 @@
|
||||
" Author: medains <https://github.com/medains>, ardis <https://github.com/ardisdreelath>
|
||||
" Author: medains <https://github.com/medains>, ardis <https://github.com/ardisdreelath>, Arizard <https://github.com/Arizard>
|
||||
" Description: phpstan for PHP files
|
||||
|
||||
" Set to change the ruleset
|
||||
@ -6,6 +6,7 @@ let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpsta
|
||||
let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '')
|
||||
let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '')
|
||||
let g:ale_php_phpstan_autoload = get(g:, 'ale_php_phpstan_autoload', '')
|
||||
let g:ale_php_phpstan_memory_limit = get(g:, 'ale_php_phpstan_memory_limit', '')
|
||||
call ale#Set('php_phpstan_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
||||
@ -19,6 +20,11 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
||||
\ ? ' -a ' . ale#Escape(l:autoload)
|
||||
\ : ''
|
||||
|
||||
let l:memory_limit = ale#Var(a:buffer, 'php_phpstan_memory_limit')
|
||||
let l:memory_limit_option = !empty(l:memory_limit)
|
||||
\ ? ' --memory-limit ' . ale#Escape(l:memory_limit)
|
||||
\ : ''
|
||||
|
||||
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
|
||||
let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
|
||||
let l:dist_config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
|
||||
@ -41,6 +47,7 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
||||
\ . l:configuration_option
|
||||
\ . l:autoload_option
|
||||
\ . l:level_option
|
||||
\ . l:memory_limit_option
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
|
@ -6,6 +6,12 @@ call ale#Set('php_psalm_options', '')
|
||||
call ale#Set('php_psalm_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
|
||||
let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json')
|
||||
|
||||
if (!empty(l:composer_path))
|
||||
return fnamemodify(l:composer_path, ':h')
|
||||
endif
|
||||
|
||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
|
||||
|
@ -29,7 +29,7 @@ function! ale_linters#python#pydocstyle#GetCommand(buffer) abort
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'python_pydocstyle_options'))
|
||||
\ . ' %s:t'
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort
|
||||
|
@ -22,6 +22,22 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylama#RunWithVersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
\ ? ' run pylama'
|
||||
\ : ''
|
||||
|
||||
let l:command = ale#Escape(l:executable) . l:exec_args . ' --version'
|
||||
|
||||
return ale#semver#RunWithVersionCheck(
|
||||
\ a:buffer,
|
||||
\ l:executable,
|
||||
\ l:command,
|
||||
\ function('ale_linters#python#pylama#GetCommand'),
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylama#GetCwd(buffer) abort
|
||||
if ale#Var(a:buffer, 'python_pylama_change_directory')
|
||||
" Pylama loads its configuration from the current directory only, and
|
||||
@ -35,27 +51,33 @@ function! ale_linters#python#pylama#GetCwd(buffer) abort
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylama#GetCommand(buffer) abort
|
||||
function! ale_linters#python#pylama#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
\ ? ' run pylama'
|
||||
\ : ''
|
||||
|
||||
" json format is added in version 8.1.4
|
||||
" https://github.com/klen/pylama/blob/develop/Changelog
|
||||
let l:format_json_args = ale#semver#GTE(a:version, [8, 1, 4])
|
||||
\ ? ' --format json'
|
||||
\ : ''
|
||||
|
||||
" Note: Using %t to lint changes would be preferable, but many pylama
|
||||
" checks use surrounding paths (e.g. C0103 module name, E0402 relative
|
||||
" import beyond top, etc.). Neither is ideal.
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'python_pylama_options'))
|
||||
\ . l:format_json_args
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylama#Handle(buffer, lines) abort
|
||||
function! ale_linters#python#pylama#Handle(buffer, version, lines) abort
|
||||
if empty(a:lines)
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = ale#python#HandleTraceback(a:lines, 1)
|
||||
let l:pattern = '\v^.{-}:([0-9]+):([0-9]+): +%(([A-Z][0-9]+):? +)?(.*)$'
|
||||
|
||||
" First letter of error code is a pylint-compatible message type
|
||||
" http://pylint.pycqa.org/en/latest/user_guide/output.html#source-code-analysis-section
|
||||
@ -75,16 +97,41 @@ function! ale_linters#python#pylama#Handle(buffer, lines) abort
|
||||
\ 'D': 'style',
|
||||
\}
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'code': l:match[3],
|
||||
\ 'type': get(l:pylint_type_to_ale_type, l:match[3][0], 'W'),
|
||||
\ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:match[3][0], ''),
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
if ale#semver#GTE(a:version, [8, 1, 4])
|
||||
try
|
||||
let l:errors = json_decode(join(a:lines, ''))
|
||||
catch
|
||||
return l:output
|
||||
endtry
|
||||
|
||||
if empty(l:errors)
|
||||
return l:output
|
||||
endif
|
||||
|
||||
for l:error in l:errors
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error['lnum'],
|
||||
\ 'col': l:error['col'],
|
||||
\ 'code': l:error['number'],
|
||||
\ 'type': get(l:pylint_type_to_ale_type, l:error['etype'], 'W'),
|
||||
\ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:error['etype'], ''),
|
||||
\ 'text': printf('%s [%s]', l:error['message'], l:error['source']),
|
||||
\})
|
||||
endfor
|
||||
else
|
||||
let l:pattern = '\v^.{-}:([0-9]+):([0-9]+): +%(([A-Z][0-9]+):? +)?(.*)$'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'code': l:match[3],
|
||||
\ 'type': get(l:pylint_type_to_ale_type, l:match[3][0], 'W'),
|
||||
\ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:match[3][0], ''),
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
@ -93,7 +140,15 @@ call ale#linter#Define('python', {
|
||||
\ 'name': 'pylama',
|
||||
\ 'executable': function('ale_linters#python#pylama#GetExecutable'),
|
||||
\ 'cwd': function('ale_linters#python#pylama#GetCwd'),
|
||||
\ 'command': function('ale_linters#python#pylama#GetCommand'),
|
||||
\ 'callback': 'ale_linters#python#pylama#Handle',
|
||||
\ 'command': function('ale_linters#python#pylama#RunWithVersionCheck'),
|
||||
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#python#pylama#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ {buffer, version -> ale_linters#python#pylama#Handle(
|
||||
\ buffer,
|
||||
\ l:version,
|
||||
\ lines)},
|
||||
\ )},
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
@ -19,6 +19,10 @@ function! ale_linters#ruby#reek#GetCommand(buffer, version) abort
|
||||
\ . l:display_name_args
|
||||
endfunction
|
||||
|
||||
function! s:GetDocumentationLink(error) abort
|
||||
return get(a:error, 'documentation_link', get(a:error, 'wiki_link', ''))
|
||||
endfunction
|
||||
|
||||
function! s:BuildText(buffer, error) abort
|
||||
let l:parts = []
|
||||
|
||||
@ -29,7 +33,7 @@ function! s:BuildText(buffer, error) abort
|
||||
call add(l:parts, a:error.message)
|
||||
|
||||
if ale#Var(a:buffer, 'ruby_reek_show_wiki_link')
|
||||
call add(l:parts, '[' . a:error.wiki_link . ']')
|
||||
call add(l:parts, '[' . s:GetDocumentationLink(a:error) . ']')
|
||||
endif
|
||||
|
||||
return join(l:parts, ' ')
|
||||
|
@ -9,9 +9,21 @@ function! ale_linters#rust#analyzer#GetCommand(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort
|
||||
" Try to find nearest Cargo.toml for cargo projects
|
||||
let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
|
||||
|
||||
return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : ''
|
||||
if !empty(l:cargo_file)
|
||||
return fnamemodify(l:cargo_file, ':h')
|
||||
endif
|
||||
|
||||
" Try to find nearest rust-project.json for non-cargo projects
|
||||
let l:rust_project = ale#path#FindNearestFile(a:buffer, 'rust-project.json')
|
||||
|
||||
if !empty(l:rust_project)
|
||||
return fnamemodify(l:rust_project, ':h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('rust', {
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
||||
" Description: rustc for rust files
|
||||
|
||||
call ale#Set('rust_rustc_options', '-Z no-codegen')
|
||||
call ale#Set('rust_rustc_options', '--emit=mir -o /dev/null')
|
||||
|
||||
function! ale_linters#rust#rustc#RustcCommand(buffer) abort
|
||||
" Try to guess the library search path. If the project is managed by cargo,
|
||||
|
@ -21,7 +21,13 @@ function! ale_linters#terraform#terraform#GetType(severity) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#terraform#GetDetail(error) abort
|
||||
return get(a:error, 'detail', get(a:error, 'summary', ''))
|
||||
let l:detail = get(a:error, 'detail', '')
|
||||
|
||||
if strlen(l:detail) > 0
|
||||
return l:detail
|
||||
else
|
||||
return get(a:error, 'summary', '')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#terraform#Handle(buffer, lines) abort
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
call ale#Set('tex_texlab_executable', 'texlab')
|
||||
call ale#Set('tex_texlab_options', '')
|
||||
call ale#Set('tex_texlab_config', {})
|
||||
|
||||
function! ale_linters#tex#texlab#GetProjectRoot(buffer) abort
|
||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
@ -21,4 +22,5 @@ call ale#linter#Define('tex', {
|
||||
\ 'executable': {b -> ale#Var(b, 'tex_texlab_executable')},
|
||||
\ 'command': function('ale_linters#tex#texlab#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#tex#texlab#GetProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'tex_texlab_config')},
|
||||
\})
|
||||
|
Reference in New Issue
Block a user