Skip to content

Commit 646d956

Browse files
authored
fix vale option (#5086)
1 parent d59cb7b commit 646d956

File tree

3 files changed

+60
-6
lines changed

3 files changed

+60
-6
lines changed

ale_linters/text/vale.vim

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
" Author: chew-z https://github.com/chew-z
22
" Description: vale for text files
33

4+
call ale#Set('vale_executable', 'vale')
5+
call ale#Set('vale_options', '')
6+
7+
function! ale_linters#text#vale#GetCommand(buffer) abort
8+
let l:executable = ale#Var(a:buffer, 'vale_executable')
9+
10+
let l:options = ale#Var(a:buffer, 'vale_options')
11+
12+
return ale#Escape(l:executable)
13+
\ . (!empty(l:options) ? ' ' . l:options : '')
14+
\ . ' --output=JSON %t'
15+
endfunction
16+
417
call ale#linter#Define('text', {
518
\ 'name': 'vale',
619
\ 'executable': 'vale',
7-
\ 'command': 'vale --output=JSON %t',
20+
\ 'command': function('ale_linters#text#vale#GetCommand'),
821
\ 'callback': 'ale#handlers#vale#Handle',
922
\})

doc/ale.txt

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ CONTENTS *ale-contents*
2828
7. Linter/Fixer Options.................|ale-integration-options|
2929
7.1 Options for alex..................|ale-alex-options|
3030
7.2 Options for cspell................|ale-cspell-options|
31-
7.3 Options for languagetool..........|ale-languagetool-options|
32-
7.4 Options for write-good............|ale-write-good-options|
33-
7.5 Options for redpen................|ale-redpen-options|
34-
7.6 Other Linter/Fixer Options........|ale-other-integration-options|
31+
7.3 Options for dprint................|ale-dprint-options|
32+
7.4 Options for languagetool..........|ale-languagetool-options|
33+
7.5 Options for write-good............|ale-write-good-options|
34+
7.6 Options for redpen................|ale-redpen-options|
35+
7.7 Options for vale..................|ale-vale-options|
36+
7.8 Other Linter/Fixer Options........|ale-other-integration-options|
3537
8. Commands/Keybinds....................|ale-commands|
3638
9. API..................................|ale-api|
3739
10. Special Thanks......................|ale-special-thanks|
@@ -3359,7 +3361,31 @@ g:ale_redpen_options
33593361

33603362

33613363
-------------------------------------------------------------------------------
3362-
7.7. Other Linter/Fixer Options *ale-other-integration-options*
3364+
7.7. Options for vale *ale-vale-options*
3365+
3366+
The following options can be used to configure the `vale` linter for text
3367+
files.
3368+
3369+
g:ale_text_vale_executable *g:ale_text_vale_executable*
3370+
Type: String
3371+
Default: 'vale'
3372+
3373+
This option controls which executable is used for running Vale. Set it to an
3374+
absolute path or a different command name if needed.
3375+
3376+
g:ale_text_vale_options *g:ale_text_vale_options*
3377+
Type: String
3378+
Default: ''
3379+
3380+
Extra command-line options to pass to the Vale executable.
3381+
3382+
Example:
3383+
3384+
let g:ale_text_vale_options = '--minAlertLevel=warning'
3385+
3386+
3387+
-------------------------------------------------------------------------------
3388+
7.8. Other Linter/Fixer Options *ale-other-integration-options*
33633389

33643390
ALE supports a very wide variety of tools. Other linter or fixer options are
33653391
documented in additional help files.

test/linter/test_text_vale.vader

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Before:
2+
call ale#assert#SetUpLinterTest('text', 'vale')
3+
4+
After:
5+
call ale#assert#TearDownLinterTest()
6+
7+
Execute(The Vale command should include extra options when configured):
8+
let g:ale_vale_executable = 'vale'
9+
let g:ale_vale_options = '--minAlertLevel=warning'
10+
AssertLinter 'vale', ale#Escape('vale') . ' --minAlertLevel=warning --output=JSON %t'
11+
12+
Execute(The Vale command should not include extra options by default):
13+
let g:ale_vale_executable = 'vale'
14+
let g:ale_vale_options = ''
15+
AssertLinter 'vale', ale#Escape('vale') . ' --output=JSON %t'

0 commit comments

Comments
 (0)