Commits

Tarek Ziadé committed 32223c8

skipping lines that end with #noqa

  • Participants
  • Parent commits 9ab4761

Comments (0)

Files changed (2)

File flake8/__init__.py

         # Okay, it's syntactically valid.  Now check it.
         w = checker.Checker(tree, filename)
         w.messages.sort(lambda a, b: cmp(a.lineno, b.lineno))
+        valid_warnings = 0
+
         for warning in w.messages:
+            if _noqa(warning):
+                continue
             print warning
-        return len(w.messages)
+            valid_warnings += 1
 
+        return valid_warnings
+
+def _noqa(warning):
+    # XXX quick dirty hack, just need to keep the line in the warning
+    line = open(warning.filename).readlines()[warning.lineno-1]
+    return line.strip().lower().endswith('# noqa')
 
 def checkPath(filename):
     """

File flake8/pep8.py

         """
         Report an error, according to options.
         """
+        if self.physical_line.strip().lower().endswith('# noqa'):
+            return
         if options.quiet == 1 and not self.file_errors:
             message(self.filename)
         self.file_errors += 1