All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: w0rp <devw0rp@gmail.com>
2 " Description: Fixing Python files with yapf.
4 call ale#Set('python_yapf_executable', 'yapf')
5 call ale#Set('python_yapf_use_global', get(g:, 'ale_use_global_executables', 0))
6 call ale#Set('python_yapf_auto_pipenv', 0)
7 call ale#Set('python_yapf_auto_poetry', 0)
8 call ale#Set('python_yapf_auto_uv', 0)
10 function! ale#fixers#yapf#GetExecutable(buffer) abort
11 if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_yapf_auto_pipenv'))
12 \ && ale#python#PipenvPresent(a:buffer)
16 if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_yapf_auto_poetry'))
17 \ && ale#python#PoetryPresent(a:buffer)
21 if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_yapf_auto_uv'))
22 \ && ale#python#UvPresent(a:buffer)
26 return ale#python#FindExecutable(a:buffer, 'python_yapf', ['yapf'])
29 function! ale#fixers#yapf#Fix(buffer) abort
30 let l:executable = ale#fixers#yapf#GetExecutable(a:buffer)
32 let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
36 let l:config = ale#path#FindNearestFile(a:buffer, '.style.yapf')
37 let l:config_options = !empty(l:config)
38 \ ? ' --no-local-style --style ' . ale#Escape(l:config)
42 \ 'command': ale#Escape(l:executable) . l:exec_args . l:config_options,