MCPcopy Create free account
hub / github.com/BVLC/caffe / _CppLintState

Class _CppLintState

scripts/cpp_lint.py:691–766  ·  view source on GitHub ↗

Maintains module-wide state..

Source from the content-addressed store, hash-verified

689
690
691class _CppLintState(object):
692 """Maintains module-wide state.."""
693
694 def __init__(self):
695 self.verbose_level = 1 # global setting.
696 self.error_count = 0 # global count of reported errors
697 # filters to apply when emitting error messages
698 self.filters = _DEFAULT_FILTERS[:]
699 self.counting = 'total' # In what way are we counting errors?
700 self.errors_by_category = {} # string to int dict storing error counts
701
702 # output format:
703 # "emacs" - format that emacs can parse (default)
704 # "vs7" - format that Microsoft Visual Studio 7 can parse
705 self.output_format = 'emacs'
706
707 def SetOutputFormat(self, output_format):
708 """Sets the output format for errors."""
709 self.output_format = output_format
710
711 def SetVerboseLevel(self, level):
712 """Sets the module's verbosity, and returns the previous setting."""
713 last_verbose_level = self.verbose_level
714 self.verbose_level = level
715 return last_verbose_level
716
717 def SetCountingStyle(self, counting_style):
718 """Sets the module's counting options."""
719 self.counting = counting_style
720
721 def SetFilters(self, filters):
722 """Sets the error-message filters.
723
724 These filters are applied when deciding whether to emit a given
725 error message.
726
727 Args:
728 filters: A string of comma-separated filters (eg "+whitespace/indent").
729 Each filter should start with + or -; else we die.
730
731 Raises:
732 ValueError: The comma-separated filters did not all start with '+' or '-'.
733 E.g. "-,+whitespace,-whitespace/indent,whitespace/badfilter"
734 """
735 # Default filters always have less priority than the flag ones.
736 self.filters = _DEFAULT_FILTERS[:]
737 for filt in filters.split(','):
738 clean_filt = filt.strip()
739 if clean_filt:
740 self.filters.append(clean_filt)
741 for filt in self.filters:
742 if not (filt.startswith('+') or filt.startswith('-')):
743 raise ValueError('Every filter in --filters must start with + or -'
744 ' (%s does not)' % filt)
745
746 def ResetErrorCounts(self):
747 """Sets the module's error statistic back to zero."""
748 self.error_count = 0

Callers 1

cpp_lint.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected