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.
2 call ale#Set('markdown_pymarkdown_executable', 'pymarkdown')
3 call ale#Set('markdown_pymarkdown_options', '')
4 call ale#Set('markdown_pymarkdown_use_global', get(g:, 'ale_use_global_executables', 0))
5 call ale#Set('markdown_pymarkdown_auto_pipenv', 0)
6 call ale#Set('markdown_pymarkdown_auto_poetry', 0)
7 call ale#Set('markdown_pymarkdown_auto_uv', 0)
9 function! ale_linters#markdown#pymarkdown#GetExecutable(buffer) abort
10 if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_pipenv'))
11 \ && ale#python#PipenvPresent(a:buffer)
15 if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_poetry'))
16 \ && ale#python#PoetryPresent(a:buffer)
20 if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_uv'))
21 \ && ale#python#UvPresent(a:buffer)
25 return ale#python#FindExecutable(a:buffer, 'markdown_pymarkdown', ['pymarkdown'])
28 function! ale_linters#markdown#pymarkdown#GetCommand(buffer) abort
29 let l:executable = ale_linters#markdown#pymarkdown#GetExecutable(a:buffer)
31 let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
35 return ale#Escape(l:executable) . l:exec_args
37 \ . ale#Var(a:buffer, 'markdown_pymarkdown_options')
41 function! ale_linters#markdown#pymarkdown#Handle(buffer, lines) abort
42 let l:pattern = '\v^(\S*):(\d+):(\d+): ([A-Z]+\d+): (.*)$'
44 " lines are formatted as follows:
45 " sample.md:1:1: MD022: Headings should be surrounded by blank lines. [Expected: 1; Actual: 0; Below] (blanks-around-headings,blanks-around-headers)
47 for l:match in ale#util#GetMatches(a:lines, l:pattern)
48 if(l:match[4] is# 'MD009')
49 \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
50 " Skip warnings for trailing whitespace if the option is off.
55 \ 'lnum': l:match[2] + 0,
56 \ 'col': l:match[3] + 0,
57 \ 'type': l:match[4][0],
62 call add(l:output, l:item)
68 call ale#linter#Define('markdown', {
69 \ 'name': 'pymarkdown',
70 \ 'executable': function('ale_linters#markdown#pymarkdown#GetExecutable'),
71 \ 'command': function('ale_linters#markdown#pymarkdown#GetCommand'),
72 \ 'callback': 'ale_linters#markdown#pymarkdown#Handle',