From 0a9f9c0811e563a5f23133796026c532acc22fd6 Mon Sep 17 00:00:00 2001 From: SABATIER Boris Date: Tue, 3 Jan 2017 11:52:58 +0100 Subject: [PATCH 1/2] Add executable and arguments options for pylint linter --- ale_linters/python/pylint.vim | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/ale_linters/python/pylint.vim b/ale_linters/python/pylint.vim index 9e6093c7..95e5f0ef 100644 --- a/ale_linters/python/pylint.vim +++ b/ale_linters/python/pylint.vim @@ -1,9 +1,26 @@ " Author: keith " Description: pylint for python files +let g:ale_python_pylint_executable = +\ get(g:, 'ale_python_pylint_executable', 'pylint') + +let g:ale_python_pylint_args = +\ get(g:, 'ale_python_pylint_args', '') + +function! ale_linters#python#pylint#GetExecutable(buffer) abort + return g:ale_python_pylint_executable +endfunction + +function! ale_linters#python#pylint#GetCommand(buffer) abort + return g:ale#util#stdin_wrapper . ' .py ' + \ . ale_linters#python#pylint#GetExecutable(a:buffer) + \ . ' ' . g:ale_python_pylint_args + \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} {msg}" --reports n' +endfunction + call ale#linter#Define('python', { \ 'name': 'pylint', -\ 'executable': 'pylint', -\ 'command': g:ale#util#stdin_wrapper . ' .py pylint --output-format text --msg-template="{path}:{line}:{column}: {msg_id} {msg}" --reports n', +\ 'executable_callback': 'ale_linters#python#pylint#GetExecutable', +\ 'command_callback': 'ale_linters#python#pylint#GetCommand', \ 'callback': 'ale#handlers#HandlePEP8Format', \}) From dc8166384c023b5de963cb21730b756f80286c90 Mon Sep 17 00:00:00 2001 From: SABATIER Boris Date: Fri, 13 Jan 2017 11:04:29 +0100 Subject: [PATCH 2/2] Add doc for pylint options --- doc/ale.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/doc/ale.txt b/doc/ale.txt index f0c5b162..75aef5d3 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -32,6 +32,7 @@ CONTENTS *ale-contents* 4.20. lacheck...............................|ale-linter-options-lacheck| 4.21. stylelint.............................|ale-linter-options-stylelint| 4.22. rustc.................................|ale-linter-options-rustc| + 4.23. python-pylint.........................|ale-linter-options-python-pylint| 5. Linter Integration Notes...................|ale-linter-integration| 5.1. merlin................................|ale-linter-integration-ocaml-merlin| 5.2. rust...................................|ale-integration-rust| @@ -790,6 +791,34 @@ g:ale_rust_ignore_error_codes *g:ale_rust_ignore_error_codes* > let g:ale_rust_ignore_error_codes = ['E0432', 'E0433'] +------------------------------------------------------------------------------- +4.23. python-pylint *ale-linter-options-python-pylint* + +g:ale_python_pylint_executable *g:ale_python_pylint_executable* + + Type: |String| + Default: `'pylint'` + + This variable can be changed to modify the executable used for pylint. + + +g:ale_python_pylint_args *g:ale_python_pylint_args* + + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the pylint + invocation. + +For example, to dynamically switch between programs targeting Python 2 and +Python 3, you may want to set > + + let g:ale_python_pylint_executable = 'python3' " or 'python' for Python 2 + let g:ale_python_pylint_args = '-rcfile /path/to/pylint.rc' + +after making sure it's installed for the appropriate Python versions (e.g. +`python3 -m pip install --user pylint`). + =============================================================================== 5. Linter Integration Notes *ale-linter-integration*