mirror of
https://github.com/amix/vimrc
synced 2025-06-24 07:44:59 +08:00
Updated plugins. Removed the tabstop merge that 010c2940ce
introduced
This commit is contained in:
35
sources_non_forked/syntastic/syntax_checkers/python/mypy.vim
Normal file
35
sources_non_forked/syntastic/syntax_checkers/python/mypy.vim
Normal file
@ -0,0 +1,35 @@
|
||||
"============================================================================
|
||||
"File: mypy.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Author: Russ Hewgill <Russ dot Hewgill at gmail dot com>
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists("g:loaded_syntastic_python_mypy_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_python_mypy_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_python_mypy_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat = '%f\, line %l: %m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': { 'type': 'E' },
|
||||
\ 'returns': [0, 1] })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'python',
|
||||
\ 'name': 'mypy'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -15,8 +15,9 @@ set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_python_pep257_GetLocList() dict
|
||||
if !exists('s:pep257_new')
|
||||
let s:pep257_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion(
|
||||
\ self.getExecEscaped() . ' --version'), [0, 3])
|
||||
let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version')
|
||||
call self.log(self.getExec() . ' version =', ver)
|
||||
let s:pep257_new = syntastic#util#versionIsAtLeast(ver, [0, 3])
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
@ -16,14 +16,38 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_python_pylint_IsAvailable() dict
|
||||
let exe = self.getExec()
|
||||
let s:pylint_new = executable(exe) ? s:PylintNew(exe) : -1
|
||||
if !executable(self.getExec())
|
||||
return 0
|
||||
endif
|
||||
|
||||
try
|
||||
" On Windows the version is shown as "pylint-script.py 1.0.0".
|
||||
" On Gentoo Linux it's "pylint-python2.7 0.28.0".
|
||||
" On NixOS, that would be ".pylint-wrapped 0.26.0".
|
||||
" On Arch Linux it's "pylint2 1.1.0".
|
||||
" On new-ish Fedora it's "python3-pylint 1.2.0".
|
||||
" Have you guys considered switching to creative writing yet? ;)
|
||||
|
||||
let pylint_version = filter( split(system(self.getExecEscaped() . ' --version'), '\m, \=\|\n'),
|
||||
\ 'v:val =~# ''\m^\(python[-0-9]*-\|\.\)\=pylint[-0-9]*\>''' )[0]
|
||||
let ver = syntastic#util#parseVersion(substitute(pylint_version, '\v^\S+\s+', '', ''))
|
||||
|
||||
call self.log(self.getExec() . ' version =', ver)
|
||||
|
||||
let s:pylint_new = syntastic#util#versionIsAtLeast(ver, [1])
|
||||
catch /\m^Vim\%((\a\+)\)\=:E684/
|
||||
call syntastic#log#error("checker python/pylint: can't parse version string (abnormal termination?)")
|
||||
let s:pylint_new = -1
|
||||
endtry
|
||||
|
||||
return s:pylint_new >= 0
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_python_pylint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': (s:pylint_new ? '-f text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n' : '-f parseable -r n -i y') })
|
||||
\ 'args_after': (s:pylint_new ?
|
||||
\ '-f text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n' :
|
||||
\ '-f parseable -r n -i y') })
|
||||
|
||||
let errorformat =
|
||||
\ '%A%f:%l:%c:%t: %m,' .
|
||||
@ -62,26 +86,6 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
function! s:PylintNew(exe)
|
||||
let exe = syntastic#util#shescape(a:exe)
|
||||
try
|
||||
" On Windows the version is shown as "pylint-script.py 1.0.0".
|
||||
" On Gentoo Linux it's "pylint-python2.7 0.28.0".
|
||||
" On NixOS, that would be ".pylint-wrapped 0.26.0".
|
||||
" On Arch Linux it's "pylint2 1.1.0".
|
||||
" On new-ish Fedora it's "python3-pylint 1.2.0".
|
||||
" Have you guys considered switching to creative writing yet? ;)
|
||||
let pylint_version = filter( split(system(exe . ' --version'), '\m, \=\|\n'),
|
||||
\ 'v:val =~# ''\m^\(python[-0-9]*-\|\.\)\=pylint[-0-9]*\>''' )[0]
|
||||
let pylint_version = substitute(pylint_version, '\v^\S+\s+', '', '')
|
||||
let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1])
|
||||
catch /\m^Vim\%((\a\+)\)\=:E684/
|
||||
call syntastic#log#error("checker python/pylint: can't parse version string (abnormal termination?)")
|
||||
let ret = -1
|
||||
endtry
|
||||
return ret
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'python',
|
||||
\ 'name': 'pylint' })
|
||||
|
@ -21,8 +21,14 @@ set cpo&vim
|
||||
let s:compiler = expand('<sfile>:p:h') . syntastic#util#Slash() . 'compile.py'
|
||||
|
||||
function! SyntaxCheckers_python_python_IsAvailable() dict
|
||||
return executable(self.getExec()) &&
|
||||
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [2, 6])
|
||||
if !executable(self.getExec())
|
||||
return 0
|
||||
endif
|
||||
|
||||
let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version')
|
||||
call self.log(self.getExec() . ' version =', ver)
|
||||
|
||||
return syntastic#util#versionIsAtLeast(ver, [2, 6])
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_python_python_GetLocList() dict
|
||||
|
Reference in New Issue
Block a user