mirror of
https://github.com/amix/vimrc
synced 2025-07-14 07:15:01 +08:00
Updated plugins
This commit is contained in:
@ -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')
|
||||
|
Reference in New Issue
Block a user