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.vim18
1 files changed, 13 insertions, 5 deletions
diff --git a/ale_linters/python/pylint.vim b/ale_linters/python/pylint.vim
index da845b7a..57e82691 100644
--- a/ale_linters/python/pylint.vim
+++ b/ale_linters/python/pylint.vim
@@ -17,9 +17,17 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort
endfunction
function! ale_linters#python#pylint#GetCommand(buffer) abort
- let l:cd_string = ale#Var(a:buffer, 'python_pylint_change_directory')
- \ ? ale#path#BufferCdString(a:buffer)
- \ : ''
+ let l:cd_string = ''
+
+ if ale#Var(a:buffer, 'python_pylint_change_directory')
+ " pylint only checks for pylintrc in the packages above its current
+ " directory before falling back to user and global pylintrc.
+ " Run from project root, if found, otherwise buffer dir.
+ let l:project_root = ale#python#FindProjectRoot(a:buffer)
+ let l:cd_string = l:project_root isnot# ''
+ \ ? ale#path#CdString(l:project_root)
+ \ : ale#path#BufferCdString(a:buffer)
+ endif
let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer)
@@ -70,8 +78,8 @@ endfunction
call ale#linter#Define('python', {
\ 'name': 'pylint',
-\ 'executable_callback': 'ale_linters#python#pylint#GetExecutable',
-\ 'command_callback': 'ale_linters#python#pylint#GetCommand',
+\ 'executable': function('ale_linters#python#pylint#GetExecutable'),
+\ 'command': function('ale_linters#python#pylint#GetCommand'),
\ 'callback': 'ale_linters#python#pylint#Handle',
\ 'lint_file': 1,
\})