Ian Cordasco committed 4ef16d6

Fixes #69

Note to self: I also have to make sure the VCS hooks work with the new
pyflakes API.

Comments (0)

Files changed (2)

     if opts.exit_zero:
         raise SystemExit(0)
-    raise SystemExit(warnings)
+    raise SystemExit(warnings > 0)
 def check_file(path, ignore=(), complexity=-1, reporter=None):
     if pep8style.excluded(path):
         return 0
     warnings = pyflakes.api.checkPath(path, reporter)
+    warnings -= reporter.ignored_warnings
     warnings += pep8style.input_file(path)
     if complexity > -1:
         warnings += mccabe.get_module_complexity(path, complexity)
 def check_code(code, ignore=(), complexity=-1, reporter=None):
     warnings = pyflakes.api.check(code, '<stdin>', reporter)
+    warnings -= reporter.ignored_warnings
     warnings += pep8style.input_file('-', lines=code.split('\n'))
     if complexity > -1:
         warnings += mccabe.get_code_complexity(code, complexity)
     def __init__(self, ignore=None):
         super(Flake8Reporter, self).__init__(sys.stdout, sys.stderr)
         self.ignore = ignore or []
+        self.ignored_warnings = 0
     def flake(self, message):
         classes = [error_mapping[i] for i in self.ignore if i in error_mapping]
         if (any(isinstance(message, c) for c in classes) or
+            self.ignored_warnings += 1
         m = self.to_str(message)
         i = m.rfind(':') + 1
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.