11 import getopt |
11 import getopt |
12 |
12 |
13 from Tools import readEncodedFile, normalizeCode |
13 from Tools import readEncodedFile, normalizeCode |
14 |
14 |
15 import pep8 |
15 import pep8 |
|
16 from Pep8NamingCheckerPy2 import Pep8NamingChecker |
|
17 |
|
18 # register the name checker |
|
19 pep8.register_check(Pep8NamingChecker, Pep8NamingChecker.Codes) |
16 |
20 |
17 |
21 |
18 class Pep8Report(pep8.BaseReport): |
22 class Pep8Report(pep8.BaseReport): |
19 """ |
23 """ |
20 Class implementing a special report to be used with our dialog. |
24 Class implementing a special report to be used with our dialog. |
38 @param offset position within line of the issue (integer) |
42 @param offset position within line of the issue (integer) |
39 @param code message code (string) |
43 @param code message code (string) |
40 @param check reference to the checker function (function) |
44 @param check reference to the checker function (function) |
41 @param args arguments for the message (list) |
45 @param args arguments for the message (list) |
42 """ |
46 """ |
43 code = super(Pep8Report, self).error_args(line_number, offset, code, check, *args) |
47 code = super(Pep8Report, self).error_args( |
|
48 line_number, offset, code, check, *args) |
44 if code and (self.counters[code] == 1 or self.__repeat): |
49 if code and (self.counters[code] == 1 or self.__repeat): |
45 self.errors.append( |
50 self.errors.append( |
46 (self.filename, line_number, offset, code, args) |
51 (self.filename, line_number, offset, code, args) |
47 ) |
52 ) |
48 return code |
53 return code |
129 print len(args) |
134 print len(args) |
130 for a in args: |
135 for a in args: |
131 print a |
136 print a |
132 print "PEP8_STATISTICS" |
137 print "PEP8_STATISTICS" |
133 for key in report.counters: |
138 for key in report.counters: |
134 if key.startswith(("E", "W")): |
139 if key.startswith(("E", "N", "W")): |
135 print key, report.counters[key] |
140 print key, report.counters[key] |
136 else: |
141 else: |
137 print "NO_PEP8" |
142 print "NO_PEP8" |
138 print filename |
143 print filename |
139 |
144 |