summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-04-10 15:18:16 +0100
committerw0rp <devw0rp@gmail.com>2018-04-10 15:18:16 +0100
commit3f0e1cd05dc526b073946ad96c64f6a5e2f9e4e6 (patch)
tree36439d5ceabbe84291ae906fe7815456602a9e33
parent9d006952497ec226e87d52dc0f8e9e408138f63b (diff)
downloadale-3f0e1cd05dc526b073946ad96c64f6a5e2f9e4e6.zip
Fix #1492 - Make pylint error parsing work on Windows
-rw-r--r--ale_linters/python/pylint.vim2
-rw-r--r--test/handler/test_pylint_handler.vader19
2 files changed, 20 insertions, 1 deletions
diff --git a/ale_linters/python/pylint.vim b/ale_linters/python/pylint.vim
index 27ee6c61..5eafd8f7 100644
--- a/ale_linters/python/pylint.vim
+++ b/ale_linters/python/pylint.vim
@@ -25,7 +25,7 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
" Matches patterns like the following:
"
" test.py:4:4: W0101 (unreachable) Unreachable code
- let l:pattern = '\v^[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$'
+ let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
diff --git a/test/handler/test_pylint_handler.vader b/test/handler/test_pylint_handler.vader
index aff40845..18f66526 100644
--- a/test/handler/test_pylint_handler.vader
+++ b/test/handler/test_pylint_handler.vader
@@ -94,3 +94,22 @@ Execute(Ignoring trailing whitespace messages should work):
\ '------------------------------------------------------------------',
\ 'Your code has been rated at 0.00/10 (previous run: 2.50/10, -2.50)',
\ ])
+
+Execute(The pylint handler should parse Windows filenames):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 13,
+ \ 'col': 6,
+ \ 'text': 'Undefined variable ''x''',
+ \ 'code': 'undefined-variable',
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#python#pylint#Handle(bufnr(''), [
+ \ '************* Module test',
+ \ 'D:\acm\github\vim\tools\test.py:13:5: E0602 (undefined-variable) Undefined variable ''x''',
+ \ '',
+ \ '------------------------------------------------------------------',
+ \ 'Your code has been rated at 5.83/10 (previous run: 5.83/10, +0.00)',
+ \ ])