1. Tarek Ziadé
  2. flake8


Steven Kryskalla  committed a354f0b

Add a flag for exiting with status code 0, even when there are warnings

This might be useful e.g. in a build system where exiting with status code > 0
always means the build failed. In that case, you still want to signify that
flake8 itself ran without problems, even when there are warnings.

  • Participants
  • Parent commits a144ea3
  • Branches default

Comments (0)

Files changed (2)

File flake8/pep8.py

View file
  • Ignore whitespace
                       help="exclude files or directories which match these "
                         "comma separated patterns (default: %s)" %
+    parser.add_option('--exit-zero', action='store_true',
+                      help="use exit code 0 (success), even if there are "
+                        "warnings")
     parser.add_option('--filename', metavar='patterns', default='*.py',
                       help="when parsing directories, only check filenames "
                         "matching these comma separated patterns (default: "

File flake8/run.py

View file
  • Ignore whitespace
         stdin = sys.stdin.read()
         warnings += check_code(stdin, complexity)
+    if options.exit_zero:
+        raise SystemExit(0)
     raise SystemExit(warnings > 0)