summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/elixir/credo.vim2
-rw-r--r--test/test_credo_handler.vader33
2 files changed, 34 insertions, 1 deletions
diff --git a/ale_linters/elixir/credo.vim b/ale_linters/elixir/credo.vim
index 4eb5e4d0..6bf3835d 100644
--- a/ale_linters/elixir/credo.vim
+++ b/ale_linters/elixir/credo.vim
@@ -4,7 +4,7 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort
" Matches patterns line the following:
"
" lib/filename.ex:19:7: F: Pipe chain should start with a raw value.
- let l:pattern = '\v^.+:(\d+):?(\d+)?: (.): (.+)$'
+ let l:pattern = '\v:(\d+):?(\d+)?: (.): (.+)$'
let l:output = []
for l:line in a:lines
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()
+