mirror of
https://github.com/dense-analysis/ale.git
synced 2026-08-03 14:38:29 +08:00
#659 - Add options for Python fixers, and cut down on duplicated documentation
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user