scrooloose/syntastic — Issue #193: some errors reported by pylint can't be parsed
Author: henix
Created: 2012-03-01 19:34:10+00:00
State: open

## Versions
pylint 0.25.0
python 2.7

## How to reproduce the bug
vimrc:

let g:syntastic_python_checker = 'pylint'

This is the test python file:

```python
class Test(object):
def test(self):
hash = 8
return hash
```

:Errors output:

test.py|1 warning 111| Missing docstring
|| test.py:1: [W0111, Test] Missing docstring
|| test.py:3: [W0622, Test.test] Redefining built-in 'hash'
|| test.py:2: [W0111, Test.test] Missing docstring
|| test.py:2: [W0201, Test.test] Method could be a function
|| test.py:1: [W0903, Test] Too few public methods (1/2)

The last 5 errors are not parsed correctly, and not shown in vim.

## Fix

The bug is in errorformat in python/pylint.vim , and this is my fix:

```diff
diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim
index 1fc880c..754c133 100644
--- a/syntax_checkers/python/pylint.vim
+++ b/syntax_checkers/python/pylint.vim
@@ -5,10 +5,10 @@
"
"============================================================================
function! SyntaxCheckers_python_GetLocList()
- let makeprg = 'pylint -f parseable -r n -i y ' .
+ let makeprg = 'pylint '.g:syntastic_python_checker_args.' -f parseable -r n -i y ' .
\ shellescape(expand('%')) .
\ ' \| sed ''s_: \[[RC]_: \[W_''' .
\ ' \| sed ''s_: \[[F]_:\ \[E_'''
- let errorformat = '%f:%l: [%t%n] %m,%-GNo config%m'
+ let errorformat = '%f:%l: [%t%n%[%^]]%#] %m,%-GNo config%m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
```

Explains:

1. I introduce a g:syntastic_python_checker_args . This makes the script more configurable.
2. The old errorformat matches errors like "[W0312]", but some errors may be like "[W0312, Test.test]", so I added a regular expression to match both.