Add configurable options support for redpen linter (#5006)

Redpen linter previously had hardcoded command-line options and duplicated
linter definitions across all supported file types (asciidoc, markdown,
review, rst, tex, text). This refactoring centralizes the linter definition
and adds support for user-configurable options via g:ale_redpen_options.

Key changes:
- Created ale#handlers#redpen#DefineLinter() to eliminate code duplication
- Added ale#handlers#redpen#GetCommand() to support configurable options
- All file types now use shared configuration and command building
- Added comprehensive test coverage for option handling
- Updated documentation for all affected file types

This allows users to customize redpen behavior with additional command-line
options while maintaining backward compatibility and reducing maintenance
overhead.
This commit is contained in:
Jason Weir
2025-08-13 06:06:06 -06:00
committed by GitHub
parent ac691b0b89
commit 5dfd1fdb9a
13 changed files with 96 additions and 38 deletions

View File

@@ -0,0 +1,29 @@
Before:
" This is just one example of a language using the linter.
call ale#assert#SetUpLinterTest('markdown', 'redpen')
unlet! g:ale_redpen_options
call ale#Set('redpen_options', '')
After:
call ale#assert#TearDownLinterTest()
Execute(The options should be omitted by default):
AssertLinter
\ 'redpen',
\ 'redpen -f markdown -r json %t'
Execute(The options should be used in the command):
let g:ale_redpen_options = '--foo --bar'
AssertLinter
\ 'redpen',
\ 'redpen -f markdown -r json --foo --bar %t'
Execute(The command should work with different filetypes):
" Test with a different filetype
call ale#assert#SetUpLinterTest('text', 'redpen')
AssertLinter
\ 'redpen',
\ 'redpen -f text -r json %t'