Add some logging to the style guide

This commit is contained in:
Ian Cordasco 2016-02-03 22:04:08 -06:00
parent 691bdc97ea
commit 1543ff8bab

View file

@ -1,11 +1,16 @@
"""Implementation of the StyleGuide used by Flake8.""" """Implementation of the StyleGuide used by Flake8."""
import logging
import enum import enum
__all__ = ( __all__ = (
'StyleGuide', 'StyleGuide',
) )
LOG = logging.getLogger(__name__)
# TODO(sigmavirus24): Determine if we need to use enum/enum34
class Selected(enum.Enum): class Selected(enum.Enum):
"""Enum representing an explicitly or implicitly selected code.""" """Enum representing an explicitly or implicitly selected code."""
@ -99,8 +104,11 @@ class StyleGuide(object):
""" """
decision = self._decision_cache.get(code) decision = self._decision_cache.get(code)
if decision is None: if decision is None:
LOG.debug('Deciding if "%s" should be reported', code)
selected = self.is_user_selected(code) selected = self.is_user_selected(code)
ignored = self.is_user_ignored(code) ignored = self.is_user_ignored(code)
LOG.debug('The user configured "%s" to be "%s", "%s"',
code, selected, ignored)
if ((selected is Selected.Explicitly or if ((selected is Selected.Explicitly or
selected is Selected.Implicitly) and selected is Selected.Implicitly) and
@ -114,6 +122,7 @@ class StyleGuide(object):
decision = Decision.Ignored decision = Decision.Ignored
self._decision_cache[code] = decision self._decision_cache[code] = decision
LOG.debug('"%s" will be "%s"', code, decision)
return decision return decision