diff options
author | Eddie Lebow <elebow@users.noreply.github.com> | 2018-06-04 22:43:02 -0400 |
---|---|---|
committer | Eddie Lebow <elebow@users.noreply.github.com> | 2018-06-05 00:33:26 -0400 |
commit | ca88e67af0dc159bdb78ad9f038d2c9336fb1b71 (patch) | |
tree | c170d053015f209714fee82d0b654981e9db45ec /ale_linters | |
parent | 5addd3abefdbc828d92386e27dedfa79d39c5d9d (diff) | |
download | ale-ca88e67af0dc159bdb78ad9f038d2c9336fb1b71.zip |
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`
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/python/mypy.vim | 6 | ||||
-rw-r--r-- | ale_linters/python/prospector.vim | 9 | ||||
-rw-r--r-- | ale_linters/python/pycodestyle.vim | 8 | ||||
-rw-r--r-- | ale_linters/python/pyflakes.vim | 8 | ||||
-rw-r--r-- | ale_linters/python/pylint.vim | 8 | ||||
-rw-r--r-- | ale_linters/python/pyls.vim | 6 |
6 files changed, 39 insertions, 6 deletions
diff --git a/ale_linters/python/mypy.vim b/ale_linters/python/mypy.vim index e8ceb6a3..b38ccdeb 100644 --- a/ale_linters/python/mypy.vim +++ b/ale_linters/python/mypy.vim @@ -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' diff --git a/ale_linters/python/prospector.vim b/ale_linters/python/prospector.vim index b3d11aa8..eadfee47 100644 --- a/ale_linters/python/prospector.vim +++ b/ale_linters/python/prospector.vim @@ -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' diff --git a/ale_linters/python/pycodestyle.vim b/ale_linters/python/pycodestyle.vim index 9254f4ab..de96363f 100644 --- a/ale_linters/python/pycodestyle.vim +++ b/ale_linters/python/pycodestyle.vim @@ -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') \ . ' -' diff --git a/ale_linters/python/pyflakes.vim b/ale_linters/python/pyflakes.vim index 475c3a6d..86ff8773 100644 --- a/ale_linters/python/pyflakes.vim +++ b/ale_linters/python/pyflakes.vim @@ -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 diff --git a/ale_linters/python/pylint.vim b/ale_linters/python/pylint.vim index a6fc8ed4..9239f835 100644 --- a/ale_linters/python/pylint.vim +++ b/ale_linters/python/pylint.vim @@ -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' diff --git a/ale_linters/python/pyls.vim b/ale_linters/python/pyls.vim index 883b38f5..010cb31f 100644 --- a/ale_linters/python/pyls.vim +++ b/ale_linters/python/pyls.vim @@ -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', { |