mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Allow all Python linter executables to be set to pipenv.
It appends ` run {linter_name}`, analogously to the Ruby linters when
the executable is set to `bundle`
This commit is contained in:
@@ -23,10 +23,14 @@ function! ale_linters#python#mypy#GetCommand(buffer) abort
|
||||
let l:dir = s:GetDir(a:buffer)
|
||||
let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
\ ? ' run mypy'
|
||||
\ : ''
|
||||
|
||||
" We have to always switch to an explicit directory for a command so
|
||||
" we can know with certainty the base path for the 'filename' keys below.
|
||||
return ale#path#CdString(l:dir)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . ale#Escape(l:executable) . l:exec_args
|
||||
\ . ' --show-column-numbers '
|
||||
\ . ale#Var(a:buffer, 'python_mypy_options')
|
||||
\ . ' --shadow-file %s %t %s'
|
||||
|
||||
@@ -14,7 +14,14 @@ function! ale_linters#python#prospector#GetExecutable(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#prospector#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#python#prospector#GetExecutable(a:buffer))
|
||||
let l:executable = ale_linters#python#prospector#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
\ ? ' run prospector'
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . l:exec_args
|
||||
\ . ' ' . ale#Var(a:buffer, 'python_prospector_options')
|
||||
\ . ' --messages-only --absolute-paths --zero-exit --output-format json'
|
||||
\ . ' %s'
|
||||
|
||||
@@ -10,7 +10,13 @@ function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pycodestyle#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#python#pycodestyle#GetExecutable(a:buffer))
|
||||
let l:executable = ale_linters#python#pycodestyle#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
\ ? ' run pycodestyle'
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
\ . ' '
|
||||
\ . ale#Var(a:buffer, 'python_pycodestyle_options')
|
||||
\ . ' -'
|
||||
|
||||
@@ -11,7 +11,13 @@ endfunction
|
||||
function! ale_linters#python#pyflakes#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' %t'
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
\ ? ' run pyflakes'
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . l:exec_args
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pyflakes#Handle(buffer, lines) abort
|
||||
|
||||
@@ -15,8 +15,14 @@ function! ale_linters#python#pylint#GetCommand(buffer) abort
|
||||
\ ? ale#path#BufferCdString(a:buffer)
|
||||
\ : ''
|
||||
|
||||
let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
\ ? ' run pylint'
|
||||
\ : ''
|
||||
|
||||
return l:cd_string
|
||||
\ . ale#Escape(ale_linters#python#pylint#GetExecutable(a:buffer))
|
||||
\ . ale#Escape(l:executable) . l:exec_args
|
||||
\ . ' ' . ale#Var(a:buffer, 'python_pylint_options')
|
||||
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n'
|
||||
\ . ' %s'
|
||||
|
||||
@@ -11,7 +11,11 @@ endfunction
|
||||
function! ale_linters#python#pyls#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pyls#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
\ ? ' run pyls'
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
|
||||
Reference in New Issue
Block a user