aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPsickOSSH2026-01-25 08:29:03 +0100
committerGitHub2026-01-25 16:29:03 +0900
commitd59cb7b3c2fe23b06423d49f1b8cc6ec226e38c3 (patch)
tree6e85539cfaf830ce4e30aecdfcd89940d822f2d4
parentc0dd8167a6fc469105e2cd8ef8a4e73cdf04e4d8 (diff)
downloadale-d59cb7b3c2fe23b06423d49f1b8cc6ec226e38c3.tar.gz

fix-proselint (#5074)

-rw-r--r--ale_linters/asciidoc/proselint.vim6
-rw-r--r--ale_linters/fountain/proselint.vim10
-rw-r--r--ale_linters/help/proselint.vim6
-rw-r--r--ale_linters/html/proselint.vim6
-rw-r--r--ale_linters/mail/proselint.vim6
-rw-r--r--ale_linters/markdown/proselint.vim6
-rw-r--r--ale_linters/nroff/proselint.vim6
-rw-r--r--ale_linters/po/proselint.vim6
-rw-r--r--ale_linters/pod/proselint.vim6
-rw-r--r--ale_linters/rst/proselint.vim8
-rw-r--r--ale_linters/tex/proselint.vim6
-rw-r--r--ale_linters/texinfo/proselint.vim6
-rw-r--r--ale_linters/text/proselint.vim6
-rw-r--r--ale_linters/xhtml/proselint.vim6
-rw-r--r--autoload/ale/proselint.vim25
-rw-r--r--test/test_proselint_get_command.vader28
-rw-r--r--test/test_proselint_get_executable.vader17
17 files changed, 129 insertions, 31 deletions
diff --git a/ale_linters/asciidoc/proselint.vim b/ale_linters/asciidoc/proselint.vim
index b636c0673..15f9b2555 100644
--- a/ale_linters/asciidoc/proselint.vim
+++ b/ale_linters/asciidoc/proselint.vim
@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for AsciiDoc files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('asciidoc', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/fountain/proselint.vim b/ale_linters/fountain/proselint.vim
index 353a2e5fe..2358c7387 100644
--- a/ale_linters/fountain/proselint.vim
+++ b/ale_linters/fountain/proselint.vim
@@ -1,9 +1,11 @@
" Author: Jansen Mitchell https://github.com/JansenMitchell
" Description: proselint for Fountain files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('fountain', {
-\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
-\ 'callback': 'ale#handlers#unix#HandleAsWarning',
+\ 'name': 'proselint',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
+\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/help/proselint.vim b/ale_linters/help/proselint.vim
index 621245021..3d13c2975 100644
--- a/ale_linters/help/proselint.vim
+++ b/ale_linters/help/proselint.vim
@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for Vim help files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('help', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/html/proselint.vim b/ale_linters/html/proselint.vim
index 9fd7d6717..5e7e94ef1 100644
--- a/ale_linters/html/proselint.vim
+++ b/ale_linters/html/proselint.vim
@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for HTML files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('html', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/mail/proselint.vim b/ale_linters/mail/proselint.vim
index 82c8d1f88..bb469ba73 100644
--- a/ale_linters/mail/proselint.vim
+++ b/ale_linters/mail/proselint.vim
@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for mail files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('mail', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/markdown/proselint.vim b/ale_linters/markdown/proselint.vim
index 289d88190..3dbc94b23 100644
--- a/ale_linters/markdown/proselint.vim
+++ b/ale_linters/markdown/proselint.vim
@@ -1,9 +1,11 @@
" Author: poohzrn https://github.com/poohzrn
" Description: proselint for Markdown files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('markdown', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/nroff/proselint.vim b/ale_linters/nroff/proselint.vim
index a23e56b11..e2ae61427 100644
--- a/ale_linters/nroff/proselint.vim
+++ b/ale_linters/nroff/proselint.vim
@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for nroff files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('nroff', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/po/proselint.vim b/ale_linters/po/proselint.vim
index ce132508c..07a93f37d 100644
--- a/ale_linters/po/proselint.vim
+++ b/ale_linters/po/proselint.vim
@@ -1,9 +1,11 @@
" Author: Cian Butler https://github.com/butlerx
" Description: proselint for PO files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('po', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/pod/proselint.vim b/ale_linters/pod/proselint.vim
index 2eb83f562..78c74b9e5 100644
--- a/ale_linters/pod/proselint.vim
+++ b/ale_linters/pod/proselint.vim
@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for Pod files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('pod', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/rst/proselint.vim b/ale_linters/rst/proselint.vim
index 018347aed..e5c4124d0 100644
--- a/ale_linters/rst/proselint.vim
+++ b/ale_linters/rst/proselint.vim
@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
-" Description: proselint for reStructuredText files
+" Description: proselint for reStructuredrst files
+
+call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('rst', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/tex/proselint.vim b/ale_linters/tex/proselint.vim
index 35e764e21..c3598d992 100644
--- a/ale_linters/tex/proselint.vim
+++ b/ale_linters/tex/proselint.vim
@@ -1,9 +1,11 @@
" Author: poohzrn https://github.com/poohzrn
" Description: proselint for TeX files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('tex', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/texinfo/proselint.vim b/ale_linters/texinfo/proselint.vim
index 003e3a0f1..f048362b1 100644
--- a/ale_linters/texinfo/proselint.vim
+++ b/ale_linters/texinfo/proselint.vim
@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for Texinfo files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('texinfo', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/text/proselint.vim b/ale_linters/text/proselint.vim
index 281b4ffae..3d6866552 100644
--- a/ale_linters/text/proselint.vim
+++ b/ale_linters/text/proselint.vim
@@ -1,9 +1,11 @@
" Author: poohzrn https://github.com/poohzrn
" Description: proselint for text files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('text', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/ale_linters/xhtml/proselint.vim b/ale_linters/xhtml/proselint.vim
index dfad921fe..dc19fab82 100644
--- a/ale_linters/xhtml/proselint.vim
+++ b/ale_linters/xhtml/proselint.vim
@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for XHTML files
+call ale#Set('proselint_executable', 'proselint')
+
call ale#linter#Define('xhtml', {
\ 'name': 'proselint',
-\ 'executable': 'proselint',
-\ 'command': 'proselint %t',
+\ 'executable': function('ale#proselint#GetExecutable'),
+\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
diff --git a/autoload/ale/proselint.vim b/autoload/ale/proselint.vim
new file mode 100644
index 000000000..e2f64e008
--- /dev/null
+++ b/autoload/ale/proselint.vim
@@ -0,0 +1,25 @@
+call ale#Set('proselint_executable', 'proselint')
+
+function! ale#proselint#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'proselint_executable')
+endfunction
+
+function! ale#proselint#GetCommand(buffer, version) abort
+ let l:executable = ale#proselint#GetExecutable(a:buffer)
+ let l:escaped_exec = ale#Escape(l:executable)
+
+ if ale#semver#GTE(a:version, [0, 16, 0])
+ return l:escaped_exec . ' check %t'
+ else
+ return l:escaped_exec . ' %t'
+ endif
+endfunction
+
+function! ale#proselint#GetCommandWithVersionCheck(buffer) abort
+ return ale#semver#RunWithVersionCheck(
+ \ a:buffer,
+ \ ale#proselint#GetExecutable(a:buffer),
+ \ '%e version --output-format json',
+ \ function('ale#proselint#GetCommand')
+ \)
+endfunction
diff --git a/test/test_proselint_get_command.vader b/test/test_proselint_get_command.vader
new file mode 100644
index 000000000..06a91dc8c
--- /dev/null
+++ b/test/test_proselint_get_command.vader
@@ -0,0 +1,28 @@
+Before:
+ runtime autoload/ale/proselint.vim
+
+ let b:ale_proselint_executable = 'proselint'
+
+After:
+ unlet! b:ale_proselint_executable
+
+Execute(Command for proselint >= 0.16.0 should use 'check'):
+ AssertEqual
+ \ ale#Escape('proselint') . ' check %t',
+ \ ale#proselint#GetCommand(bufnr(''), [0, 16, 0])
+
+ AssertEqual
+ \ ale#Escape('proselint') . ' check %t',
+ \ ale#proselint#GetCommand(bufnr(''), [0, 17, 0])
+
+Execute(Command for proselint < 0.16.0 should use standard arguments):
+ AssertEqual
+ \ ale#Escape('proselint') . ' %t',
+ \ ale#proselint#GetCommand(bufnr(''), [0, 15, 0])
+
+Execute(Command should respect custom executable path):
+ let b:ale_proselint_executable = '/custom/path/to/proselint'
+
+ AssertEqual
+ \ ale#Escape('/custom/path/to/proselint') . ' check %t',
+ \ ale#proselint#GetCommand(bufnr(''), [0, 16, 0])
diff --git a/test/test_proselint_get_executable.vader b/test/test_proselint_get_executable.vader
new file mode 100644
index 000000000..3c6e99cec
--- /dev/null
+++ b/test/test_proselint_get_executable.vader
@@ -0,0 +1,17 @@
+Before:
+ Save g:ale_proselint_executable
+ runtime autoload/ale/proselint.vim
+
+After:
+ Restore
+
+Execute(Default executable should be detected correctly):
+ AssertEqual
+ \ 'proselint',
+ \ ale#proselint#GetExecutable(bufnr(''))
+
+Execute(User specified executable should override default):
+ let g:ale_proselint_executable = '/path/to/proselint-bin'
+ AssertEqual
+ \ '/path/to/proselint-bin',
+ \ ale#proselint#GetExecutable(bufnr(''))