mirror of
https://github.com/gryf/pep8-vim.git
synced 2025-12-19 04:30:18 +01:00
Be silent in case of lack of pep8 module
This commit is contained in:
@@ -4,7 +4,7 @@ Get pep8 output on current vim buffer using pep8.Checker object
|
|||||||
try:
|
try:
|
||||||
import pep8
|
import pep8
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise AssertionError('Error: pep8_fn.vim requires module pep8')
|
pep8 = None
|
||||||
|
|
||||||
import vim
|
import vim
|
||||||
|
|
||||||
@@ -24,6 +24,10 @@ class VImPep8(object):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Run the checker"""
|
"""Run the checker"""
|
||||||
|
if not pep8:
|
||||||
|
vim.command("echo 'Error: pep8_fn.vim requires module pep8'")
|
||||||
|
return
|
||||||
|
|
||||||
pep8.process_options(['-r', vim.current.buffer.name])
|
pep8.process_options(['-r', vim.current.buffer.name])
|
||||||
checker = pep8.Checker(vim.current.buffer.name)
|
checker = pep8.Checker(vim.current.buffer.name)
|
||||||
checker.report_error = self.reporter
|
checker.report_error = self.reporter
|
||||||
|
|||||||
Reference in New Issue
Block a user