UtilitiesPython2/Pep8Checker.py

changeset 847
cc18fbcde9fc
parent 843
522c8befcf49
child 1509
c0b5e693b0eb
--- a/UtilitiesPython2/Pep8Checker.py	Sat Jan 15 16:30:40 2011 +0100
+++ b/UtilitiesPython2/Pep8Checker.py	Sat Jan 15 19:26:07 2011 +0100
@@ -56,6 +56,7 @@
         pep8.Checker.__init__(self, filename, lines)
         
         self.messages = []
+        self.statistics = {}
     
     def __ignore_code(self, code):
         """
@@ -98,13 +99,12 @@
         if self.__ignore_code(code):
             return
         
-        if code in pep8.options.counters:
-            pep8.options.counters[code] += 1
+        if code in self.statistics:
+            self.statistics[code] += 1
         else:
-            pep8.options.counters[code] = 1
-            pep8.options.messages[code] = code
+            self.statistics[code] = 1
         self.file_errors += 1
-        if pep8.options.counters[code] == 1 or pep8.options.repeat:
+        if self.statistics[code] == 1 or pep8.options.repeat:
             self.messages.append(
                 (self.filename, self.line_offset + line_number,
                  offset + 1, code, args)
@@ -164,6 +164,9 @@
                 print len(args)
                 for a in args:
                     print a
+            print "PEP8_STATISTICS"
+            for key in checker.statistics:
+                print key, checker.statistics[key]
         else:
             print "NO_PEP8"
             print filename

eric ide

mercurial