예제 #1
0
 def __init__(self,
              options=(),
              reporter=None,
              option_groups=(),
              pylintrc=None):
     # some stuff has to be done before ancestors initialization...
     #
     # messages store / checkers / reporter / astroid manager
     self.msgs_store = MessageDefinitionStore()
     self.reporter = None
     self._reporter_name = None
     self._reporters = {}
     self._checkers = collections.defaultdict(list)
     self._pragma_lineno = {}
     self._ignore_file = False
     # visit variables
     self.file_state = FileState()
     self.current_name = None
     self.current_file = None
     self.stats = None
     # init options
     self._external_opts = options
     self.options = options + PyLinter.make_options()
     self.option_groups = option_groups + PyLinter.option_groups
     self._options_methods = {
         "enable": self.enable,
         "disable": self.disable
     }
     self._bw_options_methods = {
         "disable-msg": self.disable,
         "enable-msg": self.enable,
     }
     MessagesHandlerMixIn.__init__(self)
     reporters.ReportsHandlerMixIn.__init__(self)
     super().__init__(
         usage=__doc__,
         config_file=pylintrc
         or next(config.find_default_config_files(), None),
     )
     checkers.BaseTokenChecker.__init__(self)
     # provided reports
     self.reports = (
         ("RP0001", "Messages by category", report_total_messages_stats),
         (
             "RP0002",
             "% errors / warnings by module",
             report_messages_by_module_stats,
         ),
         ("RP0003", "Messages", report_messages_stats),
     )
     self.register_checker(self)
     self._dynamic_plugins = set()
     self._python3_porting_mode = False
     self._error_mode = False
     self.load_provider_defaults()
     if reporter:
         self.set_reporter(reporter)
예제 #2
0
파일: misc.py 프로젝트: CJH01/PythonAPPUI
 def process_module(self, module):
     """Inspect the source file to find messages activated or deactivated by id."""
     managed_msgs = MessagesHandlerMixIn.get_by_id_managed_msgs()
     for (mod_name, msgid, symbol, lineno, is_disabled) in managed_msgs:
         if mod_name == module.name:
             verb = "disable" if is_disabled else "enable"
             txt = f"'{msgid}' is cryptic: use '# pylint: {verb}={symbol}' instead"
             self.add_message("use-symbolic-message-instead", line=lineno, args=txt)
     MessagesHandlerMixIn.clear_by_id_managed_msgs()
예제 #3
0
 def process_module(self, module):
     """inspect the source file to find messages activated or deactivated by id."""
     managed_msgs = MessagesHandlerMixIn.get_by_id_managed_msgs()
     for (mod_name, msg_id, msg_symbol, lineno,
          is_disabled) in managed_msgs:
         if mod_name == module.name:
             verb = "disable" if is_disabled else "enable"
             txt = f"Id '{msg_id}' is used to {verb} '{msg_symbol}' message emission"
             self.add_message("use-symbolic-message-instead",
                              line=lineno,
                              args=txt)
     MessagesHandlerMixIn.clear_by_id_managed_msgs()
예제 #4
0
파일: misc.py 프로젝트: wtracy/pylint
 def process_module(self, module):
     """inspect the source file to find messages activated or deactivated by id."""
     managed_msgs = MessagesHandlerMixIn.get_by_id_managed_msgs()
     for (mod_name, msg_id, msg_symbol, lineno, is_disabled) in managed_msgs:
         if mod_name == module.name:
             if is_disabled:
                 txt = "Id '{ident}' is used to disable '{symbol}' message emission".format(
                     ident=msg_id, symbol=msg_symbol
                 )
             else:
                 txt = "Id '{ident}' is used to enable '{symbol}' message emission".format(
                     ident=msg_id, symbol=msg_symbol
                 )
             self.add_message("use-symbolic-message-instead", line=lineno, args=txt)
     MessagesHandlerMixIn.clear_by_id_managed_msgs()