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: pyflakes for python files
4 call ale#Set('python_pyflakes_executable', 'pyflakes')
5 call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0))
6 call ale#Set('python_pyflakes_auto_pipenv', 0)
7 call ale#Set('python_pyflakes_auto_poetry', 0)
8 call ale#Set('python_pyflakes_auto_uv', 0)
10 function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
11 if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv'))
12 \ && ale#python#PipenvPresent(a:buffer)
16 if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyflakes_auto_poetry'))
17 \ && ale#python#PoetryPresent(a:buffer)
21 if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyflakes_auto_uv'))
22 \ && ale#python#UvPresent(a:buffer)
26 return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])
29 function! ale_linters#python#pyflakes#GetCommand(buffer) abort
30 let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer)
32 let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
36 return ale#Escape(l:executable)
41 function! ale_linters#python#pyflakes#Handle(buffer, lines) abort
42 let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.+)$'
45 for l:match in ale#util#GetMatches(a:lines, l:pattern)
47 \ 'lnum': l:match[1] + 0,
48 \ 'col': l:match[2] + 0,
56 call ale#linter#Define('python', {
58 \ 'executable': function('ale_linters#python#pyflakes#GetExecutable'),
59 \ 'command': function('ale_linters#python#pyflakes#GetCommand'),
60 \ 'callback': 'ale_linters#python#pyflakes#Handle',
61 \ 'output_stream': 'both',