mirror of
https://github.com/dense-analysis/ale
synced 2024-12-18 12:25:17 +00:00
181bc69c8c
The checkstyle handler is capable of parsing the new and old output formats. Unfortunately there are some particular output messages that matched both the new and old regular expressions: [WARN] whatever:11:7: WhitespaceAround: ''if'' is not followed by whitespace. [WhitespaceAround] This caused ALE to report extra errors since the message was being matched twice, once as a warning and another (incorrect) old formatted error. This MR fixes this by stopping any parsing using the old format regexp is any errors of the new format are correcly parsed. There is no reason to expect checkstyle to output both styles in the same report.
50 lines
1.6 KiB
Plaintext
50 lines
1.6 KiB
Plaintext
Before:
|
|
runtime ale_linters/java/checkstyle.vim
|
|
|
|
After:
|
|
call ale#linter#Reset()
|
|
|
|
Execute(The checkstyle handler should parse lines correctly):
|
|
AssertEqual
|
|
\ [
|
|
\ {
|
|
\ 'lnum': 101,
|
|
\ 'col': 0,
|
|
\ 'text': '''method def rcurly'' has incorrect indentation level 4, expected level should be 2.',
|
|
\ 'code': 'Indentation',
|
|
\ 'type': 'W',
|
|
\ },
|
|
\ {
|
|
\ 'lnum': 63,
|
|
\ 'col': 3,
|
|
\ 'text': 'Missing a Javadoc comment.',
|
|
\ 'code': 'JavadocMethod',
|
|
\ 'type': 'W',
|
|
\ },
|
|
\ {
|
|
\ 'lnum': 11,
|
|
\ 'col': 7,
|
|
\ 'text': 'WhitespaceAround: ''if'' is not followed by whitespace.',
|
|
\ 'code': 'WhitespaceAround',
|
|
\ 'type': 'W',
|
|
\ },
|
|
\ ],
|
|
\ ale_linters#java#checkstyle#Handle(666, [
|
|
\ '[WARN] whatever:101: ''method def rcurly'' has incorrect indentation level 4, expected level should be 2. [Indentation]',
|
|
\ '[WARN] whatever:63:3: Missing a Javadoc comment. [JavadocMethod]',
|
|
\ '[WARN] whatever:11:7: WhitespaceAround: ''if'' is not followed by whitespace. [WhitespaceAround]',
|
|
\ ])
|
|
|
|
Execute(The checkstyle handler should parse lines from older checkstyle versions correctly):
|
|
AssertEqual
|
|
\ [
|
|
\ {
|
|
\ 'lnum': 289,
|
|
\ 'text': '''method def modifier'' have incorrect indentation level 4, expected level should be 2.',
|
|
\ 'type': 'W',
|
|
\ },
|
|
\ ],
|
|
\ ale_linters#java#checkstyle#Handle(666, [
|
|
\ '/home/languitar/src/rsb-java/rsb-java/src/main/java/rsb/Listener.java:289: warning: ''method def modifier'' have incorrect indentation level 4, expected level should be 2.',
|
|
\ ])
|