diff options
author | Jon Parise <jon@indelible.org> | 2017-02-22 15:33:05 -0800 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2017-02-22 23:33:05 +0000 |
commit | c2c6c9f4918217a4201b08a62534684be012d2be (patch) | |
tree | 3e80aefbf6f1579fb8927f40e528a60256e8a0ea /test | |
parent | fef3276f34d05d30ce6127893816e2afa853023d (diff) | |
download | ale-c2c6c9f4918217a4201b08a62534684be012d2be.zip |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/test_credo_handler.vader | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/test_credo_handler.vader b/test/test_credo_handler.vader new file mode 100644 index 00000000..1100ce1b --- /dev/null +++ b/test/test_credo_handler.vader @@ -0,0 +1,33 @@ +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() + |