mirror of
https://github.com/amix/vimrc
synced 2025-07-13 23:05:01 +08:00
Updated plugins
This commit is contained in:
11
sources_non_forked/ale/ale_linters/astro/eslint.vim
Normal file
11
sources_non_forked/ale/ale_linters/astro/eslint.vim
Normal file
@ -0,0 +1,11 @@
|
||||
" Author: Hyuksang Kwon <gwonhyuksang@gmail.com>
|
||||
" Description: eslint for astro files
|
||||
|
||||
call ale#linter#Define('astro', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
@ -15,7 +15,7 @@ function! ale_linters#cmake#cmake_lint#Command(buffer) abort
|
||||
let l:executable = ale_linters#cmake#cmake_lint#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'cmake_cmake_lint_options')
|
||||
|
||||
return ale#Escape(l:executable) . ' ' . l:options . ' %t'
|
||||
return ale#Escape(l:executable) . ' ' . l:options . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Handle(buffer, lines) abort
|
||||
|
@ -11,6 +11,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'css_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
|
@ -1,6 +1,7 @@
|
||||
" Author: Nelson Yeung <nelsyeung@gmail.com>
|
||||
" Description: Check Dart files with dart analysis server LSP
|
||||
|
||||
call ale#Set('dart_analysis_server_enable_language_server', 1)
|
||||
call ale#Set('dart_analysis_server_executable', 'dart')
|
||||
|
||||
function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort
|
||||
@ -12,12 +13,19 @@ function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#analysis_server#GetCommand(buffer) abort
|
||||
let l:language_server = ale#Var(a:buffer, 'dart_analysis_server_enable_language_server')
|
||||
let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable')
|
||||
let l:dart = resolve(exepath(l:executable))
|
||||
|
||||
return '%e '
|
||||
let l:output = '%e '
|
||||
\ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot'
|
||||
\ . ' --lsp'
|
||||
|
||||
" Enable new language-server command
|
||||
if l:language_server == 1
|
||||
let l:output = '%e language-server --protocol=lsp'
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
|
@ -16,7 +16,7 @@ function! ale_linters#elm#ls#GetProjectRoot(buffer) abort
|
||||
return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#ls#GetOptions(buffer) abort
|
||||
function! ale_linters#elm#ls#GetInitializationOptions(buffer) abort
|
||||
return {
|
||||
\ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'),
|
||||
\ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'),
|
||||
@ -37,5 +37,5 @@ call ale#linter#Define('elm', {
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('ale_linters#elm#ls#GetProjectRoot'),
|
||||
\ 'language': 'elm',
|
||||
\ 'initialization_options': function('elm_ls#GetOptions')
|
||||
\ 'initialization_options': function('ale_linters#elm#ls#GetInitializationOptions')
|
||||
\})
|
||||
|
@ -26,9 +26,27 @@ function! s:AbbreviateMessage(text) abort
|
||||
endfunction
|
||||
|
||||
function! s:GetCommand(buffer) abort
|
||||
let l:file = ale#Escape(expand('#' . a:buffer . ':.'))
|
||||
let l:cwd = s:GetCwd(a:buffer)
|
||||
|
||||
return '%e rock --output-format=parsable ' . l:file
|
||||
let l:file = !empty(l:cwd)
|
||||
\ ? expand('#' . a:buffer . ':p')[len(l:cwd) + 1:]
|
||||
\ : expand('#' . a:buffer . ':.')
|
||||
|
||||
return '%e rock --output-format=parsable ' . ale#Escape(l:file)
|
||||
endfunction
|
||||
|
||||
function! s:GetCwd(buffer) abort
|
||||
let l:markers = ['elvis.config', 'rebar.lock', 'erlang.mk']
|
||||
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
for l:marker in l:markers
|
||||
if filereadable(l:path . '/' . l:marker)
|
||||
return l:path
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
@ -36,5 +54,6 @@ call ale#linter#Define('erlang', {
|
||||
\ 'callback': 'ale_linters#erlang#elvis#Handle',
|
||||
\ 'executable': {b -> ale#Var(b, 'erlang_elvis_executable')},
|
||||
\ 'command': function('s:GetCommand'),
|
||||
\ 'cwd': function('s:GetCwd'),
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
@ -21,7 +21,14 @@ function! s:GetCommand(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! s:FindProjectRoot(buffer) abort
|
||||
let l:markers = ['_build/', 'erlang_ls.config', 'rebar.lock']
|
||||
let l:markers = [
|
||||
\ '_checkouts/',
|
||||
\ '_build/',
|
||||
\ 'deps/',
|
||||
\ 'erlang_ls.config',
|
||||
\ 'rebar.lock',
|
||||
\ 'erlang.mk',
|
||||
\]
|
||||
|
||||
" This is a way to find Erlang/OTP root (the one that is managed
|
||||
" by kerl or asdf). Useful if :ALEGoToDefinition takes us there.
|
||||
|
@ -3,29 +3,13 @@
|
||||
|
||||
call ale#Set('erlang_syntaxerl_executable', 'syntaxerl')
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#RunHelpCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'erlang_syntaxerl_executable')
|
||||
|
||||
return ale#command#Run(
|
||||
\ a:buffer,
|
||||
\ ale#Escape(l:executable) . ' -h',
|
||||
\ function('ale_linters#erlang#syntaxerl#GetCommand'),
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output, meta) abort
|
||||
let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1
|
||||
|
||||
return '%e' . (l:use_b_option ? ' -b %s %t' : ' %t')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v\C:(\d+):( warning:)? (.+)'
|
||||
let l:loclist = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:loclist, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': empty(l:match[2]) ? 'E' : 'W',
|
||||
\})
|
||||
@ -34,9 +18,27 @@ function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
|
||||
return l:loclist
|
||||
endfunction
|
||||
|
||||
function! s:GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'erlang_syntaxerl_executable')
|
||||
endfunction
|
||||
|
||||
function! s:GetCommand(buffer) abort
|
||||
let l:Callback = function('s:GetCommandFromHelpOutput')
|
||||
|
||||
return ale#command#Run(a:buffer, '%e -h', l:Callback, {
|
||||
\ 'executable': s:GetExecutable(a:buffer),
|
||||
\})
|
||||
endfunction
|
||||
|
||||
function! s:GetCommandFromHelpOutput(buffer, output, metadata) abort
|
||||
let l:has_b_option = match(a:output, '\V\C-b, --base\>') > -1
|
||||
|
||||
return l:has_b_option ? '%e -b %s %t' : '%e %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'syntaxerl',
|
||||
\ 'executable': {b -> ale#Var(b, 'erlang_syntaxerl_executable')},
|
||||
\ 'command': {b -> ale_linters#erlang#syntaxerl#RunHelpCommand(b)},
|
||||
\ 'callback': 'ale_linters#erlang#syntaxerl#Handle',
|
||||
\ 'executable': function('s:GetExecutable'),
|
||||
\ 'command': function('s:GetCommand'),
|
||||
\})
|
||||
|
@ -0,0 +1,6 @@
|
||||
" Author: Sam Saffron <sam.saffron@gmail.com>
|
||||
" Description: Ember-template-lint for checking GJS (Glimmer JS) files
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
call ale#handlers#embertemplatelint#DefineLinter('glimmer')
|
@ -3,7 +3,7 @@
|
||||
|
||||
call ale#Set('go_golangci_lint_options', '')
|
||||
call ale#Set('go_golangci_lint_executable', 'golangci-lint')
|
||||
call ale#Set('go_golangci_lint_package', 0)
|
||||
call ale#Set('go_golangci_lint_package', 1)
|
||||
|
||||
function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
|
||||
let l:filename = expand('#' . a:buffer . ':t')
|
||||
|
@ -1,62 +1,6 @@
|
||||
" Author: Adrian Zalewski <aazalewski@hotmail.com>
|
||||
" Description: Ember-template-lint for checking Handlebars files
|
||||
|
||||
call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint')
|
||||
call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
scriptencoding utf-8
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
|
||||
return ale#path#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [
|
||||
\ 'node_modules/.bin/ember-template-lint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort
|
||||
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
|
||||
|
||||
return '%e --json --filename %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort
|
||||
return ale#semver#RunWithVersionCheck(
|
||||
\ a:buffer,
|
||||
\ ale_linters#handlebars#embertemplatelint#GetExecutable(a:buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#handlebars#embertemplatelint#GetCommand'),
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
|
||||
|
||||
for l:error in get(values(l:json), 0, [])
|
||||
if has_key(l:error, 'fatal')
|
||||
call add(l:output, {
|
||||
\ 'lnum': get(l:error, 'line', 1),
|
||||
\ 'col': get(l:error, 'column', 1),
|
||||
\ 'text': l:error.message,
|
||||
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
||||
\})
|
||||
else
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error.line,
|
||||
\ 'col': l:error.column,
|
||||
\ 'text': l:error.rule . ': ' . l:error.message,
|
||||
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('handlebars', {
|
||||
\ 'name': 'embertemplatelint',
|
||||
\ 'aliases': ['ember-template-lint'],
|
||||
\ 'executable': function('ale_linters#handlebars#embertemplatelint#GetExecutable'),
|
||||
\ 'command': function('ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck'),
|
||||
\ 'callback': 'ale_linters#handlebars#embertemplatelint#Handle',
|
||||
\})
|
||||
call ale#handlers#embertemplatelint#DefineLinter('handlebars')
|
||||
|
@ -21,6 +21,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale_linters#html#stylelint#GetExecutable'),
|
||||
\ 'command': function('ale_linters#html#stylelint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
|
69
sources_non_forked/ale/ale_linters/hurl/hurlfmt.vim
Normal file
69
sources_non_forked/ale/ale_linters/hurl/hurlfmt.vim
Normal file
@ -0,0 +1,69 @@
|
||||
" Description: Hurl linter using hurlfmt --check.
|
||||
" https://hurl.dev/
|
||||
|
||||
call ale#Set('hurl_hurlfmt_executable', 'hurlfmt')
|
||||
|
||||
function! ale_linters#hurl#hurlfmt#GetCommand(buffer) abort
|
||||
return '%e'
|
||||
\ . ' --check --no-color '
|
||||
endfunction
|
||||
|
||||
function! ale_linters#hurl#hurlfmt#HandleOutput(buffer, lines) abort
|
||||
" Matches patterns:
|
||||
"
|
||||
" error: Parsing space
|
||||
" --> test.hurl:11:48
|
||||
" |
|
||||
" 8 | header "Content-Type"= "application/json; charset=utf-8"
|
||||
" | ^ expecting a space
|
||||
" |
|
||||
"
|
||||
" error: Parsing URL
|
||||
" --> test.hurl:11:48
|
||||
" |
|
||||
" 11 | PUT https://jsonplaceholder.typicode.com/posts/{post_id}}
|
||||
" | ^ illegal character <{>
|
||||
" |
|
||||
"
|
||||
" Note: hurlfmt seems to report always the first error only so we assume
|
||||
" there is only one error to make parsing easier.
|
||||
let l:output = []
|
||||
|
||||
if empty(a:lines)
|
||||
return l:output
|
||||
endif
|
||||
|
||||
let l:pattern = '\v(error|warning): (.+) --\> (.+):(\d+):(\d+) .+ \^ (.+) |'
|
||||
let l:lines = join(a:lines, ' ')
|
||||
|
||||
for l:match in ale#util#GetMatches(l:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': match[4] + 0,
|
||||
\ 'col': match[5] + 0,
|
||||
\ 'end_col': match[5] + 0,
|
||||
\ 'text': match[2] . ' : ' . match[6],
|
||||
\ 'type': (match[1] is# 'error') ? 'E' : 'W'
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#hurl#hurlfmt#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('hurl', {
|
||||
\ 'name': 'hurlfmt',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'hurl_hurlfmt_executable')},
|
||||
\ 'command': function('ale_linters#hurl#hurlfmt#GetCommand'),
|
||||
\ 'callback': 'ale_linters#hurl#hurlfmt#HandleOutput',
|
||||
\})
|
11
sources_non_forked/ale/ale_linters/javascript/biome.vim
Normal file
11
sources_non_forked/ale/ale_linters/javascript/biome.vim
Normal file
@ -0,0 +1,11 @@
|
||||
" Author: Filip Gospodinov <f@gospodinov.ch>
|
||||
" Description: biome for JavaScript files
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'biome',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': function('ale#handlers#biome#GetLanguage'),
|
||||
\ 'executable': function('ale#handlers#biome#GetExecutable'),
|
||||
\ 'command': '%e lsp-proxy',
|
||||
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
|
||||
\})
|
10
sources_non_forked/ale/ale_linters/json/biome.vim
Normal file
10
sources_non_forked/ale/ale_linters/json/biome.vim
Normal file
@ -0,0 +1,10 @@
|
||||
" Description: biome for json files
|
||||
|
||||
call ale#linter#Define('json', {
|
||||
\ 'name': 'biome',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': function('ale#handlers#biome#GetLanguage'),
|
||||
\ 'executable': function('ale#handlers#biome#GetExecutable'),
|
||||
\ 'command': '%e lsp-proxy',
|
||||
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
|
||||
\})
|
10
sources_non_forked/ale/ale_linters/jsonc/biome.vim
Normal file
10
sources_non_forked/ale/ale_linters/jsonc/biome.vim
Normal file
@ -0,0 +1,10 @@
|
||||
" Description: biome for jsonc files
|
||||
|
||||
call ale#linter#Define('jsonc', {
|
||||
\ 'name': 'biome',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': function('ale#handlers#biome#GetLanguage'),
|
||||
\ 'executable': function('ale#handlers#biome#GetExecutable'),
|
||||
\ 'command': '%e lsp-proxy',
|
||||
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
|
||||
\})
|
@ -12,6 +12,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('less', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'less_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
|
19
sources_non_forked/ale/ale_linters/odin/ols.vim
Normal file
19
sources_non_forked/ale/ale_linters/odin/ols.vim
Normal file
@ -0,0 +1,19 @@
|
||||
" Author: Benjamin Block <https://github.com/benjamindblock>
|
||||
" Description: A language server for Odin.
|
||||
|
||||
function! ale_linters#odin#ols#GetProjectRoot(buffer) abort
|
||||
return fnamemodify('', ':h')
|
||||
endfunction
|
||||
|
||||
call ale#Set('odin_ols_executable', 'ols')
|
||||
call ale#Set('odin_ols_config', {})
|
||||
|
||||
call ale#linter#Define('odin', {
|
||||
\ 'name': 'ols',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': 'odin',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'odin_ols_config')},
|
||||
\ 'executable': {b -> ale#Var(b, 'odin_ols_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#odin#ols#GetProjectRoot'),
|
||||
\})
|
@ -57,12 +57,14 @@ function! ale_linters#php#phpstan#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endif
|
||||
|
||||
for l:err in l:res.files[expand('#' . a:buffer .':p')].messages
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:err.line,
|
||||
\ 'text': l:err.message,
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
for l:key in keys(l:res.files)
|
||||
for l:err in l:res.files[l:key].messages
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:err.line,
|
||||
\ 'text': l:err.message,
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
@ -7,6 +7,7 @@ call ale#Set('python_bandit_use_config', 1)
|
||||
call ale#Set('python_bandit_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_bandit_auto_pipenv', 0)
|
||||
call ale#Set('python_bandit_auto_poetry', 0)
|
||||
call ale#Set('python_bandit_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#bandit#GetExecutable(buffer) abort
|
||||
if (
|
||||
@ -23,6 +24,11 @@ function! ale_linters#python#bandit#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_bandit_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_bandit', ['bandit'])
|
||||
endfunction
|
||||
|
||||
@ -39,7 +45,7 @@ function! ale_linters#python#bandit#GetCommand(buffer) abort
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run bandit'
|
||||
\ : ''
|
||||
|
||||
|
@ -7,6 +7,7 @@ call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0
|
||||
call ale#Set('python_flake8_change_directory', 'project')
|
||||
call ale#Set('python_flake8_auto_pipenv', 0)
|
||||
call ale#Set('python_flake8_auto_poetry', 0)
|
||||
call ale#Set('python_flake8_auto_uv', 0)
|
||||
|
||||
function! s:UsingModule(buffer) abort
|
||||
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
|
||||
@ -23,6 +24,11 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_flake8_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
if !s:UsingModule(a:buffer)
|
||||
return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8'])
|
||||
endif
|
||||
@ -68,7 +74,7 @@ endfunction
|
||||
function! ale_linters#python#flake8#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run flake8'
|
||||
\ : ''
|
||||
|
||||
|
@ -7,6 +7,7 @@ call ale#Set('python_flakehell_use_global', get(g:, 'ale_use_global_executables'
|
||||
call ale#Set('python_flakehell_change_directory', 'project')
|
||||
call ale#Set('python_flakehell_auto_pipenv', 0)
|
||||
call ale#Set('python_flakehell_auto_poetry', 0)
|
||||
call ale#Set('python_flakehell_auto_uv', 0)
|
||||
|
||||
function! s:UsingModule(buffer) abort
|
||||
return ale#Var(a:buffer, 'python_flakehell_executable') is? 'python'
|
||||
@ -23,6 +24,11 @@ function! ale_linters#python#flakehell#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_flakehell_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
if !s:UsingModule(a:buffer)
|
||||
return ale#python#FindExecutable(a:buffer, 'python_flakehell', ['flakehell'])
|
||||
endif
|
||||
@ -68,7 +74,7 @@ endfunction
|
||||
function! ale_linters#python#flakehell#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer)
|
||||
|
||||
if (l:executable =~? 'pipenv\|poetry$')
|
||||
if (l:executable =~? 'pipenv\|poetry\|uv$')
|
||||
let l:exec_args = ' run flakehell'
|
||||
elseif (l:executable is? 'python')
|
||||
let l:exec_args = ' -m flakehell'
|
||||
|
@ -4,6 +4,8 @@
|
||||
call ale#Set('python_jedils_executable', 'jedi-language-server')
|
||||
call ale#Set('python_jedils_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_jedils_auto_pipenv', 0)
|
||||
call ale#Set('python_jedils_auto_poetry', 0)
|
||||
call ale#Set('python_jedils_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#jedils#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_jedils_auto_pipenv'))
|
||||
@ -11,12 +13,22 @@ function! ale_linters#python#jedils#GetExecutable(buffer) abort
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_jedils_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_jedils_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_jedils', ['jedi-language-server'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#jedils#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#jedils#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run jedi-language-server'
|
||||
\ : ''
|
||||
let l:env_string = ''
|
||||
|
@ -8,6 +8,7 @@ call ale#Set('python_mypy_options', '')
|
||||
call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_mypy_auto_pipenv', 0)
|
||||
call ale#Set('python_mypy_auto_poetry', 0)
|
||||
call ale#Set('python_mypy_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#mypy#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_mypy_auto_pipenv'))
|
||||
@ -20,6 +21,11 @@ function! ale_linters#python#mypy#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_mypy_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy'])
|
||||
endfunction
|
||||
|
||||
@ -43,7 +49,7 @@ endfunction
|
||||
|
||||
function! ale_linters#python#mypy#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run mypy'
|
||||
\ : ''
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
call ale#Set('python_prospector_auto_pipenv', 0)
|
||||
call ale#Set('python_prospector_auto_poetry', 0)
|
||||
call ale#Set('python_prospector_auto_uv', 0)
|
||||
|
||||
let g:ale_python_prospector_executable =
|
||||
\ get(g:, 'ale_python_prospector_executable', 'prospector')
|
||||
@ -23,13 +24,18 @@ function! ale_linters#python#prospector#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_prospector_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#prospector#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#prospector#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run prospector'
|
||||
\ : ''
|
||||
|
||||
|
@ -7,6 +7,7 @@ call ale#Set('python_pycln_use_global', get(g:, 'ale_use_global_executables', 0)
|
||||
call ale#Set('python_pycln_change_directory', 1)
|
||||
call ale#Set('python_pycln_auto_pipenv', 0)
|
||||
call ale#Set('python_pycln_auto_poetry', 0)
|
||||
call ale#Set('python_pycln_auto_uv', 0)
|
||||
call ale#Set('python_pycln_config_file', '')
|
||||
|
||||
function! ale_linters#python#pycln#GetExecutable(buffer) abort
|
||||
@ -20,6 +21,11 @@ function! ale_linters#python#pycln#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycln_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln'])
|
||||
endfunction
|
||||
|
||||
@ -36,7 +42,7 @@ endfunction
|
||||
|
||||
function! ale_linters#python#pycln#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#pycln#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run pycln'
|
||||
\ : ''
|
||||
|
||||
|
@ -6,6 +6,7 @@ call ale#Set('python_pycodestyle_options', '')
|
||||
call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pycodestyle_auto_pipenv', 0)
|
||||
call ale#Set('python_pycodestyle_auto_poetry', 0)
|
||||
call ale#Set('python_pycodestyle_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv'))
|
||||
@ -18,13 +19,18 @@ function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycodestyle_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pycodestyle#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pycodestyle#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run pycodestyle'
|
||||
\ : ''
|
||||
|
||||
|
@ -6,6 +6,7 @@ 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)
|
||||
call ale#Set('python_pydocstyle_auto_poetry', 0)
|
||||
call ale#Set('python_pydocstyle_auto_uv', 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'))
|
||||
@ -18,12 +19,17 @@ function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pydocstyle_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pydocstyle', ['pydocstyle'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pydocstyle#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run pydocstyle'
|
||||
\ : ''
|
||||
|
||||
|
@ -5,6 +5,7 @@ call ale#Set('python_pyflakes_executable', 'pyflakes')
|
||||
call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pyflakes_auto_pipenv', 0)
|
||||
call ale#Set('python_pyflakes_auto_poetry', 0)
|
||||
call ale#Set('python_pyflakes_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv'))
|
||||
@ -17,13 +18,18 @@ function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyflakes_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pyflakes#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run pyflakes'
|
||||
\ : ''
|
||||
|
||||
|
@ -6,6 +6,7 @@ call ale#Set('python_pylama_options', '')
|
||||
call ale#Set('python_pylama_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pylama_auto_pipenv', 0)
|
||||
call ale#Set('python_pylama_auto_poetry', 0)
|
||||
call ale#Set('python_pylama_auto_uv', 0)
|
||||
call ale#Set('python_pylama_change_directory', 1)
|
||||
|
||||
function! ale_linters#python#pylama#GetExecutable(buffer) abort
|
||||
@ -19,12 +20,17 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylama_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
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$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run pylama'
|
||||
\ : ''
|
||||
|
||||
@ -53,7 +59,7 @@ endfunction
|
||||
|
||||
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$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run pylama'
|
||||
\ : ''
|
||||
|
||||
|
@ -7,6 +7,7 @@ call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0
|
||||
call ale#Set('python_pylint_change_directory', 1)
|
||||
call ale#Set('python_pylint_auto_pipenv', 0)
|
||||
call ale#Set('python_pylint_auto_poetry', 0)
|
||||
call ale#Set('python_pylint_auto_uv', 0)
|
||||
call ale#Set('python_pylint_use_msg_id', 0)
|
||||
|
||||
function! ale_linters#python#pylint#GetExecutable(buffer) abort
|
||||
@ -20,6 +21,11 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylint_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint'])
|
||||
endfunction
|
||||
|
||||
@ -38,7 +44,7 @@ endfunction
|
||||
|
||||
function! ale_linters#python#pylint#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run pylint'
|
||||
\ : ''
|
||||
|
||||
|
@ -6,6 +6,7 @@ call ale#Set('python_pylsp_options', '')
|
||||
call ale#Set('python_pylsp_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pylsp_auto_pipenv', 0)
|
||||
call ale#Set('python_pylsp_auto_poetry', 0)
|
||||
call ale#Set('python_pylsp_auto_uv', 0)
|
||||
call ale#Set('python_pylsp_config', {})
|
||||
|
||||
function! ale_linters#python#pylsp#GetExecutable(buffer) abort
|
||||
@ -19,6 +20,11 @@ function! ale_linters#python#pylsp#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylsp_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp'])
|
||||
endfunction
|
||||
|
||||
@ -37,7 +43,7 @@ endfunction
|
||||
|
||||
function! ale_linters#python#pylsp#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run pylsp'
|
||||
\ : ''
|
||||
let l:env_string = ''
|
||||
|
@ -5,6 +5,7 @@ call ale#Set('python_pyre_executable', 'pyre')
|
||||
call ale#Set('python_pyre_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pyre_auto_pipenv', 0)
|
||||
call ale#Set('python_pyre_auto_poetry', 0)
|
||||
call ale#Set('python_pyre_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#pyre#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyre_auto_pipenv'))
|
||||
@ -17,12 +18,17 @@ function! ale_linters#python#pyre#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyre_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pyre#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pyre#GetExecutable(a:buffer)
|
||||
let l:exec_args = (l:executable =~? 'pipenv\|poetry$' ? ' run pyre' : '') . ' persistent'
|
||||
let l:exec_args = (l:executable =~? 'pipenv\|poetry\|uv$' ? ' run pyre' : '') . ' persistent'
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
endfunction
|
||||
|
@ -3,6 +3,7 @@ call ale#Set('python_pyright_executable', 'pyright-langserver')
|
||||
call ale#Set('python_pyright_config', {})
|
||||
call ale#Set('python_pyright_auto_pipenv', 0)
|
||||
call ale#Set('python_pyright_auto_poetry', 0)
|
||||
call ale#Set('python_pyright_auto_uv', 0)
|
||||
|
||||
" Force the cwd of the server to be the same as the project root to
|
||||
" fix issues with treating local files matching first or third party library
|
||||
@ -59,12 +60,17 @@ function! ale_linters#python#pyright#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyright_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pyright', ['pyright-langserver'])
|
||||
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$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run pyright-langserver'
|
||||
\ : ''
|
||||
let l:env_string = ''
|
||||
|
@ -7,6 +7,7 @@ call ale#Set('python_refurb_use_global', get(g:, 'ale_use_global_executables', 0
|
||||
call ale#Set('python_refurb_change_directory', 1)
|
||||
call ale#Set('python_refurb_auto_pipenv', 0)
|
||||
call ale#Set('python_refurb_auto_poetry', 0)
|
||||
call ale#Set('python_refurb_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#refurb#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_refurb_auto_pipenv'))
|
||||
@ -19,6 +20,11 @@ function! ale_linters#python#refurb#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_refurb_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_refurb', ['refurb'])
|
||||
endfunction
|
||||
|
||||
@ -35,7 +41,7 @@ endfunction
|
||||
|
||||
function! ale_linters#python#refurb#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#refurb#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run refurb'
|
||||
\ : ''
|
||||
|
||||
|
@ -7,6 +7,7 @@ call ale#Set('python_ruff_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_ruff_change_directory', 1)
|
||||
call ale#Set('python_ruff_auto_pipenv', 0)
|
||||
call ale#Set('python_ruff_auto_poetry', 0)
|
||||
call ale#Set('python_ruff_auto_uv', 0)
|
||||
|
||||
call ale#fix#registry#Add('ruff',
|
||||
\ 'ale#fixers#ruff#Fix',
|
||||
@ -25,6 +26,11 @@ function! ale_linters#python#ruff#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ruff_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
|
||||
endfunction
|
||||
|
||||
@ -41,13 +47,18 @@ endfunction
|
||||
|
||||
function! ale_linters#python#ruff#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#ruff#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run ruff'
|
||||
\ : ''
|
||||
|
||||
" NOTE: ruff version `0.0.69` supports liniting input from stdin
|
||||
" NOTE: ruff 0.3.0 deprecates `ruff <path>` in favor of `ruff check <path>`
|
||||
let l:exec_args = l:exec_args
|
||||
\ . (ale#semver#GTE(a:version, [0, 3, 0]) ? ' check' : '')
|
||||
|
||||
" NOTE: ruff version `0.0.69` supports linting input from stdin
|
||||
" NOTE: ruff version `0.1.0` deprecates `--format text`
|
||||
return ale#Escape(l:executable) . l:exec_args . ' -q'
|
||||
\ . ' --no-fix'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'python_ruff_options'))
|
||||
\ . (ale#semver#GTE(a:version, [0, 1, 0]) ? ' --output-format json-lines' : ' --format json-lines')
|
||||
\ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' --stdin-filename %s -' : ' %s')
|
||||
@ -56,17 +67,25 @@ endfunction
|
||||
function! ale_linters#python#ruff#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
" Read all lines of ruff output and parse use all the valid JSONL lines.
|
||||
for l:line in a:lines
|
||||
let l:item = json_decode(l:line)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:item.location.row,
|
||||
\ 'col': l:item.location.column,
|
||||
\ 'end_lnum': l:item.end_location.row,
|
||||
\ 'end_col': l:item.end_location.column - 1,
|
||||
\ 'code': l:item.code,
|
||||
\ 'text': l:item.message,
|
||||
\ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W',
|
||||
\})
|
||||
try
|
||||
let l:item = json_decode(l:line)
|
||||
catch
|
||||
let l:item = v:null
|
||||
endtry
|
||||
|
||||
if !empty(l:item)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:item.location.row,
|
||||
\ 'col': l:item.location.column,
|
||||
\ 'end_lnum': l:item.end_location.row,
|
||||
\ 'end_col': l:item.end_location.column - 1,
|
||||
\ 'code': l:item.code,
|
||||
\ 'text': l:item.message,
|
||||
\ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
@ -5,6 +5,7 @@ call ale#Set('python_unimport_options', '')
|
||||
call ale#Set('python_unimport_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_unimport_auto_pipenv', 0)
|
||||
call ale#Set('python_unimport_auto_poetry', 0)
|
||||
call ale#Set('python_unimport_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#unimport#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_unimport_auto_pipenv'))
|
||||
@ -17,12 +18,17 @@ function! ale_linters#python#unimport#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_unimport_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_unimport', ['unimport'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#unimport#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#unimport#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run unimport'
|
||||
\ : ''
|
||||
|
||||
|
@ -5,6 +5,9 @@ call ale#Set('python_vulture_executable', 'vulture')
|
||||
call ale#Set('python_vulture_options', '')
|
||||
call ale#Set('python_vulture_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_vulture_change_directory', 1)
|
||||
call ale#Set('python_vulture_auto_pipenv', 0)
|
||||
call ale#Set('python_vulture_auto_poetry', 0)
|
||||
call ale#Set('python_vulture_auto_uv', 0)
|
||||
|
||||
" The directory to change to before running vulture
|
||||
function! s:GetDir(buffer) abort
|
||||
@ -16,6 +19,21 @@ function! s:GetDir(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#vulture#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_vulture_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_vulture_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_vulture_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_vulture', ['vulture'])
|
||||
endfunction
|
||||
|
||||
@ -29,7 +47,7 @@ endfunction
|
||||
|
||||
function! ale_linters#python#vulture#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#vulture#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run vulture'
|
||||
\ : ''
|
||||
let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory')
|
||||
|
172
sources_non_forked/ale/ale_linters/ruby/steep.vim
Normal file
172
sources_non_forked/ale/ale_linters/ruby/steep.vim
Normal file
@ -0,0 +1,172 @@
|
||||
call ale#Set('ruby_steep_executable', 'steep')
|
||||
call ale#Set('ruby_steep_options', '')
|
||||
|
||||
" Find the nearest dir containing a Steepfile
|
||||
function! ale_linters#ruby#steep#FindRoot(buffer) abort
|
||||
for l:name in ['Steepfile']
|
||||
let l:dir = fnamemodify(
|
||||
\ ale#path#FindNearestFile(a:buffer, l:name),
|
||||
\ ':h'
|
||||
\)
|
||||
|
||||
if l:dir isnot# '.' && isdirectory(l:dir)
|
||||
return l:dir
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Rename path relative to root
|
||||
function! ale_linters#ruby#steep#RelativeToRoot(buffer, path) abort
|
||||
let l:separator = has('win32') ? '\' : '/'
|
||||
let l:steep_root = ale_linters#ruby#steep#FindRoot(a:buffer)
|
||||
|
||||
" path isn't under root
|
||||
if l:steep_root is# ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:steep_root_prefix = l:steep_root . l:separator
|
||||
|
||||
" win32 path separators get interpreted by substitute, escape them
|
||||
if has('win32')
|
||||
let l:steep_root_pat = substitute(l:steep_root_prefix, '\\', '\\\\', 'g')
|
||||
else
|
||||
let l:steep_root_pat = l:steep_root_prefix
|
||||
endif
|
||||
|
||||
return substitute(a:path, l:steep_root_pat, '', '')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#steep#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_steep_executable')
|
||||
|
||||
" steep check needs to apply some config from the file path so:
|
||||
" - steep check can't use stdin (no path)
|
||||
" - steep check can't use %t (path outside of project)
|
||||
" => we can only use %s
|
||||
|
||||
" somehow :ALEInfo shows that ALE still appends '< %t' to the command
|
||||
" => luckily steep check ignores stdin
|
||||
|
||||
" somehow steep has a problem with absolute path to file but a path
|
||||
" relative to Steepfile directory works:
|
||||
" see https://github.com/soutaro/steep/pull/975
|
||||
" => change to Steepfile directory and remove leading path
|
||||
|
||||
let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p')
|
||||
let l:buffer_filename = fnameescape(l:buffer_filename)
|
||||
|
||||
let l:relative = ale_linters#ruby#steep#RelativeToRoot(a:buffer, l:buffer_filename)
|
||||
|
||||
" if file is not under steep root, steep can't type check
|
||||
if l:relative is# ''
|
||||
" don't execute
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'steep')
|
||||
\ . ' check '
|
||||
\ . ale#Var(a:buffer, 'ruby_steep_options')
|
||||
\ . ' ' . fnameescape(l:relative)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#steep#GetType(severity) abort
|
||||
if a:severity is? 'information'
|
||||
\|| a:severity is? 'hint'
|
||||
return 'I'
|
||||
endif
|
||||
|
||||
if a:severity is? 'warning'
|
||||
return 'W'
|
||||
endif
|
||||
|
||||
return 'E'
|
||||
endfunction
|
||||
|
||||
" Handle output from steep
|
||||
function! ale_linters#ruby#steep#HandleOutput(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
let l:in = 0
|
||||
let l:item = {}
|
||||
|
||||
for l:line in a:lines
|
||||
" Look for first line of a message block
|
||||
" If not in-message (l:in == 0) that's expected
|
||||
" If in-message (l:in > 0) that's less expected but let's recover
|
||||
let l:match = matchlist(l:line, '^\([^:]*\):\([0-9]*\):\([0-9]*\): \[\([^]]*\)\] \(.*\)')
|
||||
|
||||
if len(l:match) > 0
|
||||
" Something is lingering: recover by pushing what is there
|
||||
if len(l:item) > 0
|
||||
call add(l:output, l:item)
|
||||
let l:item = {}
|
||||
endif
|
||||
|
||||
let l:filename = l:match[1]
|
||||
|
||||
" Steep's reported column is offset by 1 (zero-indexed?)
|
||||
let l:item = {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 1,
|
||||
\ 'type': ale_linters#ruby#steep#GetType(l:match[4]),
|
||||
\ 'text': l:match[5],
|
||||
\}
|
||||
|
||||
" Done with this line, mark being in-message and go on with next line
|
||||
let l:in = 1
|
||||
continue
|
||||
endif
|
||||
|
||||
" We're past the first line of a message block
|
||||
if l:in > 0
|
||||
" Look for code in subsequent lines of the message block
|
||||
if l:line =~# '^│ Diagnostic ID:'
|
||||
let l:match = matchlist(l:line, '^│ Diagnostic ID: \(.*\)')
|
||||
|
||||
if len(l:match) > 0
|
||||
let l:item.code = l:match[1]
|
||||
endif
|
||||
|
||||
" Done with the line
|
||||
continue
|
||||
endif
|
||||
|
||||
" Look for last line of the message block
|
||||
if l:line =~# '^└'
|
||||
" Done with the line, mark looking for underline and go on with the next line
|
||||
let l:in = 2
|
||||
continue
|
||||
endif
|
||||
|
||||
" Look for underline right after last line
|
||||
if l:in == 2
|
||||
let l:match = matchlist(l:line, '\([~][~]*\)')
|
||||
|
||||
if len(l:match) > 0
|
||||
let l:item.end_col = l:item['col'] + len(l:match[1]) - 1
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
|
||||
" Done with the line, mark looking for first line and go on with the next line
|
||||
let l:in = 0
|
||||
let l:item = {}
|
||||
continue
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'steep',
|
||||
\ 'executable': {b -> ale#Var(b, 'ruby_steep_executable')},
|
||||
\ 'language': 'ruby',
|
||||
\ 'command': function('ale_linters#ruby#steep#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#ruby#steep#FindRoot'),
|
||||
\ 'callback': 'ale_linters#ruby#steep#HandleOutput',
|
||||
\})
|
@ -5,6 +5,7 @@ call ale#Set('sass_stylelint_use_global', get(g:, 'ale_use_global_executables',
|
||||
|
||||
call ale#linter#Define('sass', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'sass_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
|
@ -11,6 +11,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('scss', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'scss_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
|
@ -11,7 +11,7 @@ function! ale_linters#sql#sqlfluff#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'sql_sqlfluff_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sql#sqlfluff#Command(buffer) abort
|
||||
function! ale_linters#sql#sqlfluff#Command(buffer, version) abort
|
||||
let l:executable = ale_linters#sql#sqlfluff#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'sql_sqlfluff_options')
|
||||
|
||||
@ -35,7 +35,7 @@ function! ale_linters#sql#sqlfluff#Command(buffer) abort
|
||||
return l:cmd
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sql#sqlfluff#Handle(buffer, lines) abort
|
||||
function! ale_linters#sql#sqlfluff#Handle(buffer, version, lines) abort
|
||||
let l:output = []
|
||||
let l:json_lines = ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
|
||||
@ -50,16 +50,31 @@ function! ale_linters#sql#sqlfluff#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endif
|
||||
|
||||
for l:violation in get(l:json, 'violations', [])
|
||||
call add(l:output, {
|
||||
\ 'filename': l:json.filepath,
|
||||
\ 'lnum': l:violation.line_no,
|
||||
\ 'col': l:violation.line_pos,
|
||||
\ 'text': l:violation.description,
|
||||
\ 'code': l:violation.code,
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
if ale#semver#GTE(a:version, [3, 0, 0])
|
||||
for l:violation in get(l:json, 'violations', [])
|
||||
call add(l:output, {
|
||||
\ 'filename': l:json.filepath,
|
||||
\ 'lnum': l:violation.start_line_no,
|
||||
\ 'end_lnum': l:violation.end_line_no,
|
||||
\ 'col': l:violation.start_line_pos,
|
||||
\ 'end_col': l:violation.end_line_pos,
|
||||
\ 'text': l:violation.description,
|
||||
\ 'code': l:violation.code,
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
else
|
||||
for l:violation in get(l:json, 'violations', [])
|
||||
call add(l:output, {
|
||||
\ 'filename': l:json.filepath,
|
||||
\ 'lnum': l:violation.line_no,
|
||||
\ 'col': l:violation.line_pos,
|
||||
\ 'text': l:violation.description,
|
||||
\ 'code': l:violation.code,
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
@ -67,6 +82,19 @@ endfunction
|
||||
call ale#linter#Define('sql', {
|
||||
\ 'name': 'sqlfluff',
|
||||
\ 'executable': function('ale_linters#sql#sqlfluff#Executable'),
|
||||
\ 'command': function('ale_linters#sql#sqlfluff#Command'),
|
||||
\ 'callback': 'ale_linters#sql#sqlfluff#Handle',
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#sql#sqlfluff#Executable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#sql#sqlfluff#Command'),
|
||||
\ )},
|
||||
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#sql#sqlfluff#Executable(buffer),
|
||||
\ '%e --version',
|
||||
\ {buffer, version -> ale_linters#sql#sqlfluff#Handle(
|
||||
\ buffer,
|
||||
\ l:version,
|
||||
\ lines)},
|
||||
\ )},
|
||||
\})
|
||||
|
@ -12,6 +12,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('stylus', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'stylus_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
|
@ -13,6 +13,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('sugarss', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'sugarss_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
|
@ -1,29 +1,34 @@
|
||||
" Author: Andrew Balmos - <andrew@balmos.org>
|
||||
" Description: chktex for LaTeX files
|
||||
|
||||
let g:ale_tex_chktex_executable =
|
||||
\ get(g:, 'ale_tex_chktex_executable', 'chktex')
|
||||
call ale#Set('tex_chktex_executable', 'chktex')
|
||||
call ale#Set('tex_chktex_options', '-I')
|
||||
|
||||
let g:ale_tex_chktex_options =
|
||||
\ get(g:, 'ale_tex_chktex_options', '-I')
|
||||
function! ale_linters#tex#chktex#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'tex_chktex_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#tex#chktex#GetCommand(buffer) abort
|
||||
" Check for optional .chktexrc
|
||||
let l:chktex_config = ale#path#FindNearestFile(
|
||||
\ a:buffer,
|
||||
\ '.chktexrc')
|
||||
function! ale_linters#tex#chktex#GetCommand(buffer, version) abort
|
||||
let l:options = ''
|
||||
|
||||
let l:command = ale#Var(a:buffer, 'tex_chktex_executable')
|
||||
" Avoid bug when used without -p (last warning has gibberish for a filename)
|
||||
let l:command .= ' -v0 -p stdin -q'
|
||||
let l:options .= ' -v0 -p stdin -q'
|
||||
|
||||
if !empty(l:chktex_config)
|
||||
let l:command .= ' -l ' . ale#Escape(l:chktex_config)
|
||||
" Avoid bug of reporting wrong column when using tabs (issue #723)
|
||||
if ale#semver#GTE(a:version, [1, 7, 7])
|
||||
let l:options .= ' -S TabSize=1'
|
||||
endif
|
||||
|
||||
let l:command .= ' ' . ale#Var(a:buffer, 'tex_chktex_options')
|
||||
" Check for optional .chktexrc
|
||||
let l:chktex_config = ale#path#FindNearestFile(a:buffer, '.chktexrc')
|
||||
|
||||
return l:command
|
||||
if !empty(l:chktex_config)
|
||||
let l:options .= ' -l ' . ale#Escape(l:chktex_config)
|
||||
endif
|
||||
|
||||
let l:options .= ' ' . ale#Var(a:buffer, 'tex_chktex_options')
|
||||
|
||||
return '%e' . l:options
|
||||
endfunction
|
||||
|
||||
function! ale_linters#tex#chktex#Handle(buffer, lines) abort
|
||||
@ -48,7 +53,12 @@ endfunction
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'chktex',
|
||||
\ 'executable': 'chktex',
|
||||
\ 'command': function('ale_linters#tex#chktex#GetCommand'),
|
||||
\ 'executable': function('ale_linters#tex#chktex#GetExecutable'),
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#tex#chktex#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#tex#chktex#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale_linters#tex#chktex#Handle'
|
||||
\})
|
||||
|
11
sources_non_forked/ale/ale_linters/typescript/biome.vim
Normal file
11
sources_non_forked/ale/ale_linters/typescript/biome.vim
Normal file
@ -0,0 +1,11 @@
|
||||
" Author: Filip Gospodinov <f@gospodinov.ch>
|
||||
" Description: biome for TypeScript files
|
||||
|
||||
call ale#linter#Define('typescript', {
|
||||
\ 'name': 'biome',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': function('ale#handlers#biome#GetLanguage'),
|
||||
\ 'executable': function('ale#handlers#biome#GetExecutable'),
|
||||
\ 'command': '%e lsp-proxy',
|
||||
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
|
||||
\})
|
53
sources_non_forked/ale/ale_linters/verilog/slang.vim
Normal file
53
sources_non_forked/ale/ale_linters/verilog/slang.vim
Normal file
@ -0,0 +1,53 @@
|
||||
" Author: Alvin Rolling <alvinrolling@gmail.com>
|
||||
" Description: slang for verilog files
|
||||
|
||||
" Set this option to change Slang lint options
|
||||
if !exists('g:ale_verilog_slang_options')
|
||||
let g:ale_verilog_slang_options = ''
|
||||
endif
|
||||
|
||||
" --lint-only
|
||||
function! ale_linters#verilog#slang#GetCommand(buffer) abort
|
||||
return 'slang -Weverything '
|
||||
\ . '-I%s:h '
|
||||
\ . ale#Var(a:buffer, 'verilog_slang_options') .' '
|
||||
\ . '%t'
|
||||
endfunction
|
||||
|
||||
function! s:RemoveUnicodeQuotes(text) abort
|
||||
let l:text = a:text
|
||||
let l:text = substitute(l:text, '[`´‘’]', '''', 'g')
|
||||
let l:text = substitute(l:text, '[“”]', '"', 'g')
|
||||
|
||||
return l:text
|
||||
endfunction
|
||||
|
||||
function! ale_linters#verilog#slang#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+)?:?(\d+)?:? ([^:]+): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': (l:match[4] is# 'error') ? 'E' : 'W',
|
||||
\ 'text': s:RemoveUnicodeQuotes(l:match[5]),
|
||||
\}
|
||||
|
||||
if !empty(l:match[3])
|
||||
let l:item.col = str2nr(l:match[3])
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('verilog', {
|
||||
\ 'name': 'slang',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'slang',
|
||||
\ 'command': function('ale_linters#verilog#slang#GetCommand'),
|
||||
\ 'callback': 'ale_linters#verilog#slang#Handle',
|
||||
\ 'read_buffer': 0,
|
||||
\})
|
@ -5,6 +5,11 @@ call ale#Set('yaml_actionlint_executable', 'actionlint')
|
||||
call ale#Set('yaml_actionlint_options', '')
|
||||
|
||||
function! ale_linters#yaml#actionlint#GetCommand(buffer) abort
|
||||
" Only execute actionlint on YAML files in /.github/ paths.
|
||||
if expand('#' . a:buffer . ':p') !~# '\v[/\\]\.github[/\\]'
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'yaml_actionlint_options')
|
||||
|
||||
if l:options !~# '-no-color'
|
||||
@ -15,21 +20,33 @@ function! ale_linters#yaml#actionlint#GetCommand(buffer) abort
|
||||
let l:options .= ale#Pad('-oneline')
|
||||
endif
|
||||
|
||||
return '%e' . ale#Pad(l:options)
|
||||
return '%e' . ale#Pad(l:options) . ' - '
|
||||
endfunction
|
||||
|
||||
function! ale_linters#yaml#actionlint#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
".github/workflows/main.yml:19:0: could not parse as YAML: yaml: line 19: mapping values are not allowed in this context [yaml-syntax]
|
||||
let l:pattern = '\v^.*:(\d+):(\d+): (.+) \[(.+)\]$'
|
||||
let l:pattern = '\v^.{-}:(\d+):(\d+): (.+) \[(.+)\]$'
|
||||
let l:output = []
|
||||
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[4]
|
||||
let l:text = l:match[3]
|
||||
|
||||
" Handle sub-linter errors like the following:
|
||||
"validate.yml:19:9: shellcheck reported issue in this script: SC2086:info:1:15: Double quote to prevent globbing and word splitting [shellcheck]
|
||||
if l:code is# 'shellcheck'
|
||||
let l:shellcheck_match = matchlist(l:text, '\v^.+: (SC\d{4}):.+:\d+:\d+: (.+)$')
|
||||
let l:text = l:shellcheck_match[2]
|
||||
let l:code = 'shellcheck ' . l:shellcheck_match[1]
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'code': l:match[4],
|
||||
\ 'text': l:text,
|
||||
\ 'code': l:code,
|
||||
\ 'type': 'E',
|
||||
\}
|
||||
|
||||
|
Reference in New Issue
Block a user