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: circld <circld1@gmail.com>
2 " Description: Fixing files with autoflake.
4 call ale#Set('python_autoflake_executable', 'autoflake')
5 call ale#Set('python_autoflake_use_global', get(g:, 'ale_use_global_executables', 0))
6 call ale#Set('python_autoflake_options', '')
7 call ale#Set('python_autoflake_auto_pipenv', 0)
8 call ale#Set('python_autoflake_auto_poetry', 0)
9 call ale#Set('python_autoflake_auto_uv', 0)
11 function! ale#fixers#autoflake#GetExecutable(buffer) abort
12 if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_autoflake_auto_pipenv'))
13 \ && ale#python#PipenvPresent(a:buffer)
17 if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_autoflake_auto_poetry'))
18 \ && ale#python#PoetryPresent(a:buffer)
22 if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_autoflake_auto_uv'))
23 \ && ale#python#UvPresent(a:buffer)
27 return ale#python#FindExecutable(a:buffer, 'python_autoflake', ['autoflake'])
30 function! ale#fixers#autoflake#Fix(buffer) abort
31 let l:executable = ale#fixers#autoflake#GetExecutable(a:buffer)
33 let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
37 let l:options = ale#Var(a:buffer, 'python_autoflake_options')
40 \ 'command': ale#Escape(l:executable) . l:exec_args
41 \ . (!empty(l:options) ? ' ' . l:options : '')
44 \ 'read_temporary_file': 1,