summaryrefslogtreecommitdiff
path: root/src/flake8/formatting/base.py
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-07-25 14:29:09 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2016-07-25 14:29:09 -0500
commit4dc1d11a627a571eeae4e0ae3da7b94e7de04214 (patch)
treefee0c2657ffb9d298305fa775ff4abd24cfd6c54 /src/flake8/formatting/base.py
parentfc035c4df280e1f10c2e1f73ce8c2ea2af5c99a7 (diff)
downloadflake8-bug/180.tar.gz
Wire-up --statistics againbug/180
I'm not sure where this code went or when, but it disappeared. Let's add it back. Related #180
Diffstat (limited to 'src/flake8/formatting/base.py')
-rw-r--r--src/flake8/formatting/base.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/flake8/formatting/base.py b/src/flake8/formatting/base.py
index 7c2e4b5..c4a626b 100644
--- a/src/flake8/formatting/base.py
+++ b/src/flake8/formatting/base.py
@@ -85,6 +85,19 @@ class BaseFormatter(object):
raise NotImplementedError('Subclass of BaseFormatter did not implement'
' format.')
+ def show_statistics(self, statistics):
+ """Format and print the statistics."""
+ for error_code in statistics.error_codes():
+ stats_for_error_code = statistics.statistics_for(error_code)
+ statistic = next(stats_for_error_code)
+ count = statistic.count
+ count += sum(stat.count for stat in stats_for_error_code)
+ self._write('{count:<5} {error_code} {message}'.format(
+ count=count,
+ error_code=error_code,
+ message=statistic.message,
+ ))
+
def show_benchmarks(self, benchmarks):
"""Format and print the benchmarks."""
# NOTE(sigmavirus24): The format strings are a little confusing, even