From 3ad798db61b87a82bcea6e83d387bb228e071870 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Sat, 7 May 2016 19:34:27 -0500 Subject: [PATCH] Implement --exit-zero functionality --- flake8/main/cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flake8/main/cli.py b/flake8/main/cli.py index 9d6e824..22c63de 100644 --- a/flake8/main/cli.py +++ b/flake8/main/cli.py @@ -197,6 +197,10 @@ class Application(object): self.args = None self.result_count = 0 + def exit(self): + if not self.options.exit_zero: + raise SystemExit(self.result_count > 0) + def find_plugins(self): # type: () -> NoneType """Find and load the plugins for this application.""" @@ -309,4 +313,4 @@ def main(argv=None): """Main entry-point for the flake8 command-line tool.""" app = Application() app.run(argv) - raise SystemExit(app.result_count > 0) + app.exit()