Commits

Ian Cordasco committed 25103cb

Fixes #14 and #19.

@BackSeat contributed the patch. Signature changes are mentioned in README.

  • Participants
  • Parent commits 97b2ffa
  • Branches fix_excludes

Comments (0)

Files changed (4)

 =======
 
 1.6
+---
 
-XXX
+- changed the signatures of the ``check_file`` function in flake8/run.py, 
+  ``skip_warning`` in flake8/util.py and the ``check``, ``checkPath``
+  functions in flake8/pyflakes.py.
 
 
 1.5 - 2012-10-13

File flake8/pyflakes.py

             self.addBinding(node.lineno, importation)
 
 
-def checkPath(filename):
+def checkPath(filename, ignore=[]):
     """
     Check the given path, printing out any warnings detected.
 
     @return: the number of warnings printed
     """
     try:
-        return check(open(filename, 'U').read() + '\n', filename)
+        return check(open(filename, 'U').read() + '\n', ignore, filename)
     except IOError:
         msg = sys.exc_info()[1]
         sys.stderr.write("%s: %s\n" % (filename, msg.args[1]))
         return 1
 
 
-def check(codeString, filename='(code)'):
+def check(codeString, ignore, filename='(code)'):
     """
     Check the Python source given by C{codeString} for flakes.
 
         valid_warnings = 0
 
         for warning in w.messages:
-            if skip_warning(warning):
+            if skip_warning(warning, ignore):
                 continue
             print(warning)
             valid_warnings += 1

File flake8/run.py

 pep8style = None
 
 
-def check_file(path, complexity=-1):
+def check_file(path, ignore=[], complexity=-1):
     if pep8style.excluded(path):
         return 0
-    warnings = pyflakes.checkPath(path)
+    warnings = pyflakes.checkPath(path, ignore)
     warnings += pep8style.input_file(path)
     if complexity > -1:
         warnings += mccabe.get_module_complexity(path, complexity)
 
     if pep8style.paths and options.filename is not None:
         for path in _get_python_files(pep8style.paths):
-            warnings += check_file(path, complexity)
+            warnings += check_file(path, options.ignore, complexity)
     else:
         # wait for 1 second on the stdin fd
         reads, __, __ = select.select([sys.stdin], [], [], 1.)

File flake8/util.py

 import os
 
 
-def skip_warning(warning):
+def skip_warning(warning, ignore=[]):
     # XXX quick dirty hack, just need to keep the line in the warning
+    if warning.message.split()[0] in ignore:
+        return True
     if not os.path.isfile(warning.filename):
         return False