Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Adjust for newer weirdness in the python/pylama checker.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcd047 committed Aug 16, 2013
1 parent 8fb6504 commit 3a03fee
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions syntax_checkers/python/pylama.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_python_pylama_checker")
if exists('g:loaded_syntastic_python_pylama_checker')
finish
endif
let g:loaded_syntastic_python_pylama_checker=1
let g:loaded_syntastic_python_pylama_checker = 1

function! SyntaxCheckers_python_pylama_IsAvailable()
return executable('pylama')
Expand All @@ -25,20 +25,34 @@ endfunction
function! SyntaxCheckers_python_pylama_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'pylama',
\ 'post_args': ' -f pep8',
\ 'post_args': '-f pep8',
\ 'filetype': 'python',
\ 'subchecker': 'pylama' })

let errorformat = '%A%f:%l:%c: %m'
" TODO: "WARNING:pylama:..." messages are probably a logging bug
let errorformat =
\ '%-GWARNING:pylama:%.%#,' .
\ '%A%f:%l:%c: %m'

let loclist=SyntasticMake({
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['sort'] })

" adjust for weirdness in each checker
for n in range(len(loclist))
let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][0]) >= 0 ? 'W' : 'E'
if loclist[n]['text'] =~# '\v\[%(pep8|pep257|mccabe)\]$'
if loclist[n]['text'] =~# '\v\[%(mccabe|pep257|pylint)\]$'
if has_key(loclist[n], 'col')
let loclist[n]['col'] += 1
endif
endif
if loclist[n]['text'] =~# '\v\[pylint\]$'
if has_key(loclist[n], 'vcol')
let loclist[n]['vcol'] = 0
endif
endif
if loclist[n]['text'] =~# '\v\[%(mccabe|pep257|pep8)\]$'
let loclist[n]['subtype'] = 'Style'
endif
endfor
Expand Down

0 comments on commit 3a03fee

Please sign in to comment.