ale/test/test_credo_handler.vader
Jon Parise c2c6c9f491 Fix Credo's line-matching pattern (#360)
* Fix Credo's line-matching pattern

In d3e7d3d5, the line matching pattern was changed to handle filenames
other than `stdin`. Unfortunately, this broke the pattern's ability to
reliably extract both line and column numbers because the latter is an
optional match and the filename portion was very greedy. This resulted
in line numbers being discarded (treated as part of the filename) and
column numbers being interpreted as line numbers.

This change simplifies the pattern to only anchor on the line's suffix,
ignoring the filename portion entirely.

Alternatively, we could use vim's `\f` ("file name characters") class,
but that could still run into problems when `:`'s naturally appear in
the filename.

* Add a Vader test case for the Credo handler
2017-02-22 23:33:05 +00:00

34 lines
932 B
Plaintext

Execute(The credo handler should parse lines correctly):
runtime ale_linters/elixir/credo.vim
AssertEqual
\ [
\ {
\ 'bufnr': 347,
\ 'lnum': 1,
\ 'vcol': 0,
\ 'col': 4,
\ 'text': 'There is no whitespace around parentheses/brackets most of the time, but here there is.',
\ 'type': 'E',
\ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 26,
\ 'vcol': 0,
\ 'col': 0,
\ 'text': 'If/else blocks should not have a negated condition in `if`.',
\ 'type': 'W',
\ 'nr': -1,
\ },
\ ],
\ ale_linters#elixir#credo#Handle(347, [
\ 'This line should be ignored completely',
\ 'lib/filename.ex:1:4: C: There is no whitespace around parentheses/brackets most of the time, but here there is.',
\ 'lib/phoenix/channel.ex:26: R: If/else blocks should not have a negated condition in `if`.',
\ ])
After:
call ale#linter#Reset()