mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
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:
29
test/linter/test_redpen.vader
Normal file
29
test/linter/test_redpen.vader
Normal 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'
|
||||
Reference in New Issue
Block a user