#659 - Add options for Python fixers, and cut down on duplicated documentation

This commit is contained in:
w0rp
2017-06-18 11:03:31 +01:00
parent fb682be199
commit 629ff513ec
18 changed files with 287 additions and 217 deletions
+15 -2
View File
@@ -1,13 +1,26 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Fixing files with autopep8.
call ale#Set('python_autopep8_executable', 'autopep8')
call ale#Set('python_autopep8_use_global', 0)
call ale#Set('python_autopep8_options', '')
function! ale#fixers#autopep8#Fix(buffer) abort
let l:executable = ale#python#GetExecutable(a:buffer, 'autopep8')
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_autopep8',
\ ['/bin/autopep8'],
\)
if empty(l:executable)
return 0
endif
let l:options = ale#Var(a:buffer, 'python_autopep8_options')
return {
\ 'command': ale#Escape(l:executable) . ' -'
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -',
\}
endfunction
+9 -1
View File
@@ -1,8 +1,16 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Fixing Python imports with isort.
call ale#Set('python_isort_executable', 'isort')
call ale#Set('python_isort_use_global', 0)
function! ale#fixers#isort#Fix(buffer) abort
let l:executable = ale#python#GetExecutable(a:buffer, 'isort')
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_isort',
\ ['/bin/isort'],
\)
if empty(l:executable)
return 0
endif
+9 -1
View File
@@ -1,8 +1,16 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Fixing Python files with yapf.
call ale#Set('python_yapf_executable', 'yapf')
call ale#Set('python_yapf_use_global', 0)
function! ale#fixers#yapf#Fix(buffer) abort
let l:executable = ale#python#GetExecutable(a:buffer, 'yapf')
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_yapf',
\ ['/bin/yapf'],
\)
if empty(l:executable)
return 0
endif