mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-14 16:34:46 +00:00
Add statistics collection to StyleGuide
This commit is contained in:
parent
61430951ec
commit
14cab7e81b
1 changed files with 3 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ import linecache
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from flake8 import statistics
|
||||||
from flake8 import utils
|
from flake8 import utils
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
|
|
@ -74,6 +75,7 @@ class StyleGuide(object):
|
||||||
self.options = options
|
self.options = options
|
||||||
self.listener = listener_trie
|
self.listener = listener_trie
|
||||||
self.formatter = formatter
|
self.formatter = formatter
|
||||||
|
self.stats = statistics.Statistics()
|
||||||
self._selected = tuple(options.select)
|
self._selected = tuple(options.select)
|
||||||
self._ignored = tuple(options.ignore)
|
self._ignored = tuple(options.ignore)
|
||||||
self._decision_cache = {}
|
self._decision_cache = {}
|
||||||
|
|
@ -267,6 +269,7 @@ class StyleGuide(object):
|
||||||
if (error_is_selected and is_not_inline_ignored and
|
if (error_is_selected and is_not_inline_ignored and
|
||||||
is_included_in_diff):
|
is_included_in_diff):
|
||||||
self.formatter.handle(error)
|
self.formatter.handle(error)
|
||||||
|
self.stats.record(error)
|
||||||
self.listener.notify(error.code, error)
|
self.listener.notify(error.code, error)
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue