summaryrefslogtreecommitdiff
path: root/ale_linters/python/pylint.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/python/pylint.vim')
-rw-r--r--ale_linters/python/pylint.vim26
1 files changed, 17 insertions, 9 deletions
diff --git a/ale_linters/python/pylint.vim b/ale_linters/python/pylint.vim
index e3e6624d..9239f835 100644
--- a/ale_linters/python/pylint.vim
+++ b/ale_linters/python/pylint.vim
@@ -1,20 +1,28 @@
" Author: keith <k@keith.so>
" Description: pylint for python files
-let g:ale_python_pylint_executable =
-\ get(g:, 'ale_python_pylint_executable', 'pylint')
-
-let g:ale_python_pylint_options =
-\ get(g:, 'ale_python_pylint_options', '')
-
-let g:ale_python_pylint_use_global = get(g:, 'ale_python_pylint_use_global', 0)
+call ale#Set('python_pylint_executable', 'pylint')
+call ale#Set('python_pylint_options', '')
+call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0))
+call ale#Set('python_pylint_change_directory', 1)
function! ale_linters#python#pylint#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint'])
endfunction
function! ale_linters#python#pylint#GetCommand(buffer) abort
- return ale#Escape(ale_linters#python#pylint#GetExecutable(a:buffer))
+ let l:cd_string = ale#Var(a:buffer, 'python_pylint_change_directory')
+ \ ? 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(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'
@@ -24,7 +32,7 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
" Matches patterns like the following:
"
" test.py:4:4: W0101 (unreachable) Unreachable code
- let l:pattern = '\v^[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$'
+ let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)