Created
May 2, 2013 07:19
-
-
Save florentx/5500654 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import pep8 | |
class MyReport(pep8.BaseReport): | |
def __init__(self, options): | |
super(MyReport, self).__init__(options) | |
self.all_errors = [] | |
def error(self, line_number, offset, text, check): | |
code = super(MyReport, self).error(line_number, offset, text, check) | |
# XXX do something useful | |
err = (self.filename, line_number, offset, code, text) | |
self.all_errors.append(err) | |
return code | |
pep8style = pep8.StyleGuide(reporter=MyReport) | |
report = pep8style.check_files(['file1.py', 'file2.py']) | |
for err in report.all_errors: | |
print(err) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment