From 14cab7e81b1bed1022f4fdce32d4b1777b055988 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Tue, 12 Jul 2016 20:04:04 -0500 Subject: [PATCH] Add statistics collection to StyleGuide --- src/flake8/style_guide.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/flake8/style_guide.py b/src/flake8/style_guide.py index 89890ba..ed1b844 100644 --- a/src/flake8/style_guide.py +++ b/src/flake8/style_guide.py @@ -5,6 +5,7 @@ import linecache import logging import re +from flake8 import statistics from flake8 import utils __all__ = ( @@ -74,6 +75,7 @@ class StyleGuide(object): self.options = options self.listener = listener_trie self.formatter = formatter + self.stats = statistics.Statistics() self._selected = tuple(options.select) self._ignored = tuple(options.ignore) self._decision_cache = {} @@ -267,6 +269,7 @@ class StyleGuide(object): if (error_is_selected and is_not_inline_ignored and is_included_in_diff): self.formatter.handle(error) + self.stats.record(error) self.listener.notify(error.code, error) return 1 return 0