From a82f8cb580da54a5d534314cb6fdbeb2a9acd804 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Sat, 7 May 2016 20:13:07 -0500 Subject: [PATCH] Print the total number of errors before exiting --- flake8/main/cli.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/flake8/main/cli.py b/flake8/main/cli.py index 22c63de..1208bfc 100644 --- a/flake8/main/cli.py +++ b/flake8/main/cli.py @@ -1,4 +1,6 @@ """Command-line implementation of flake8.""" +from __future__ import print_function + import logging import flake8 @@ -198,6 +200,15 @@ class Application(object): self.result_count = 0 def exit(self): + # type: () -> NoneType + """Handle finalization and exiting the program. + + This should be the last thing called on the application instance. It + will check certain options and exit appropriately. + """ + if self.options.count: + print(self.result_count) + if not self.options.exit_zero: raise SystemExit(self.result_count > 0)