2013-07-14 12:13:18 -04:00
|
|
|
"============================================================================
|
|
|
|
"File: pylama.vim
|
|
|
|
"Description: Syntax checking plugin for syntastic.vim
|
|
|
|
"Maintainer: LCD 47 <lcd047 at gmail dot com>
|
|
|
|
"License: This program is free software. It comes without any warranty,
|
|
|
|
" to the extent permitted by applicable law. You can redistribute
|
|
|
|
" it and/or modify it under the terms of the Do What The Fuck You
|
|
|
|
" Want To Public License, Version 2, as published by Sam Hocevar.
|
|
|
|
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
|
|
|
"
|
|
|
|
"============================================================================
|
2014-01-03 04:29:08 -05:00
|
|
|
|
2013-08-16 02:14:52 -04:00
|
|
|
if exists('g:loaded_syntastic_python_pylama_checker')
|
2013-07-14 12:13:18 -04:00
|
|
|
finish
|
|
|
|
endif
|
2013-08-16 02:14:52 -04:00
|
|
|
let g:loaded_syntastic_python_pylama_checker = 1
|
2013-07-14 12:13:18 -04:00
|
|
|
|
2014-01-03 04:29:08 -05:00
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
|
|
|
function! SyntaxCheckers_python_pylama_GetHighlightRegex(item)
|
|
|
|
return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:item)
|
2013-07-14 12:13:18 -04:00
|
|
|
endfunction
|
|
|
|
|
2013-10-28 07:53:33 -04:00
|
|
|
function! SyntaxCheckers_python_pylama_GetLocList() dict
|
2014-01-28 14:44:44 -05:00
|
|
|
let makeprg = self.makeprgBuild({ 'args_after': '-f pep8' })
|
2013-07-14 12:13:18 -04:00
|
|
|
|
2013-08-16 02:14:52 -04:00
|
|
|
" TODO: "WARNING:pylama:..." messages are probably a logging bug
|
|
|
|
let errorformat =
|
|
|
|
\ '%-GWARNING:pylama:%.%#,' .
|
|
|
|
\ '%A%f:%l:%c: %m'
|
2013-07-14 12:13:18 -04:00
|
|
|
|
2013-08-16 02:14:52 -04:00
|
|
|
let loclist = SyntasticMake({
|
2013-07-14 12:13:18 -04:00
|
|
|
\ 'makeprg': makeprg,
|
2014-04-16 15:16:40 -04:00
|
|
|
\ 'errorformat': errorformat })
|
2013-07-14 12:13:18 -04:00
|
|
|
|
2013-08-16 02:14:52 -04:00
|
|
|
" adjust for weirdness in each checker
|
2013-11-08 03:45:15 -05:00
|
|
|
for e in loclist
|
2013-11-29 03:18:53 -05:00
|
|
|
let e['type'] = e['text'] =~? '\m^[RCW]' ? 'W' : 'E'
|
2013-11-04 16:00:51 -05:00
|
|
|
if e['text'] =~# '\v\[%(mccabe|pep257|pylint)\]$'
|
|
|
|
if has_key(e, 'col')
|
|
|
|
let e['col'] += 1
|
2013-08-16 02:14:52 -04:00
|
|
|
endif
|
|
|
|
endif
|
2013-11-04 16:00:51 -05:00
|
|
|
if e['text'] =~# '\v\[pylint\]$'
|
|
|
|
if has_key(e, 'vcol')
|
|
|
|
let e['vcol'] = 0
|
2013-08-16 02:14:52 -04:00
|
|
|
endif
|
|
|
|
endif
|
2013-11-04 16:00:51 -05:00
|
|
|
if e['text'] =~# '\v\[%(mccabe|pep257|pep8)\]$'
|
|
|
|
let e['subtype'] = 'Style'
|
2013-07-15 04:24:41 -04:00
|
|
|
endif
|
2013-07-14 12:13:18 -04:00
|
|
|
endfor
|
|
|
|
|
2014-04-16 15:16:40 -04:00
|
|
|
call self.setWantSort(1)
|
|
|
|
|
2013-07-14 12:13:18 -04:00
|
|
|
return loclist
|
|
|
|
endfunction
|
|
|
|
|
2013-10-28 11:30:25 -04:00
|
|
|
runtime! syntax_checkers/python/pyflakes.vim
|
|
|
|
|
2013-07-14 12:13:18 -04:00
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'python',
|
|
|
|
\ 'name': 'pylama' })
|
2014-01-03 04:29:08 -05:00
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
|
|
|
" vim: set et sts=4 sw=4:
|