Beispiel #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 = MessagesStore()
     self.reporter = None
     self._reporter_name = None
     self._reporters = {}
     self._checkers = {}
     self._ignore_file = False
     # visit variables
     self.file_state = FileState()
     self.current_name = None
     self.current_file = None
     self.stats = None
     # init 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
     }
     full_version = '%%prog %s, \nastroid %s, common %s\nPython %s' % (
         version, astroid_version, common_version, sys.version)
     OptionsManagerMixIn.__init__(self,
                                  usage=__doc__,
                                  version=full_version,
                                  config_file=pylintrc or config.PYLINTRC)
     MessagesHandlerMixIn.__init__(self)
     ReportsHandlerMixIn.__init__(self)
     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),
         ('RP0004', 'Global evaluation', self.report_evaluation),
     )
     self.register_checker(self)
     self._dynamic_plugins = set()
     self.load_provider_defaults()
     if reporter:
         self.set_reporter(reporter)
Beispiel #2
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:
             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()
 def __init__(self,
              options=(),
              reporter=None,
              option_groups=(),
              pylintrc=None):
     # some stuff has to be done before ancestors initialization...
     #
     # checkers / reporter / astng manager
     self.reporter = None
     self._checkers = {}
     self._ignore_file = False
     # visit variables
     self.base_name = None
     self.base_file = None
     self.current_name = None
     self.current_file = None
     self.stats = None
     # init options
     self.options = options + PyLinter.options
     self.option_groups = option_groups + PyLinter.option_groups
     self._options_methods = {
         'enable-report': self.enable_report,
         'disable-report': self.disable_report,
         'enable-msg': self.enable_message,
         'disable-msg': self.disable_message,
         'enable-msg-cat': self.enable_message_category,
         'disable-msg-cat': self.disable_message_category
     }
     full_version = '%%prog %s, \nastng %s, common %s\nPython %s' % (
         version, astng_version, common_version, sys.version)
     OptionsManagerMixIn.__init__(self,
                                  usage=__doc__,
                                  version=full_version,
                                  config_file=pylintrc or config.PYLINTRC)
     MessagesHandlerMixIn.__init__(self)
     ReportsHandlerMixIn.__init__(self)
     BaseRawChecker.__init__(self)
     # provided reports
     self.reports = (
         ('R0001', 'Messages by category', report_total_messages_stats),
         ('R0002', '% errors / warnings by module',
          report_messages_by_module_stats),
         ('R0003', 'Messages', report_messages_stats),
         ('R0004', 'Global evaluation', self.report_evaluation),
     )
     self.register_checker(self)
     self._dynamic_plugins = []
     self.load_provider_defaults()
     self.set_reporter(reporter or TextReporter(sys.stdout))
Beispiel #4
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:
             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()
Beispiel #5
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 = MessagesStore()
     self.reporter = None
     self._reporter_name = None
     self._reporters = {}
     self._checkers = {}
     self._ignore_file = False
     # visit variables
     self.file_state = FileState()
     self.current_name = None
     self.current_file = None
     self.stats = None
     # init 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}
     full_version = '%%prog %s, \nastroid %s, common %s\nPython %s' % (
         version, astroid_version, common_version, sys.version)
     OptionsManagerMixIn.__init__(self, usage=__doc__,
                                  version=full_version,
                                  config_file=pylintrc or config.PYLINTRC)
     MessagesHandlerMixIn.__init__(self)
     ReportsHandlerMixIn.__init__(self)
     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),
                     ('RP0004', 'Global evaluation',
                      self.report_evaluation),
                    )
     self.register_checker(self)
     self._dynamic_plugins = set()
     self.load_provider_defaults()
     if reporter:
         self.set_reporter(reporter)
Beispiel #6
0
 def __init__(self, options=(), reporter=None, option_groups=(),
              pylintrc=None):
     # some stuff has to be done before ancestors initialization...
     #
     # checkers / reporter / astng manager
     self.reporter = None
     self.manager = ASTNGManager()
     self._checkers = {}
     self._ignore_file = False        
     # visit variables
     self.base_name = None
     self.base_file = None
     self.current_name = None
     self.current_file = None
     self.stats = None
     # init options
     self.options = options + PyLinter.options
     self.option_groups = option_groups + PyLinter.option_groups
     self._options_methods = {
         'enable-report': self.enable_report,
         'disable-report': self.disable_report,
         'enable-msg': self.enable_message,
         'disable-msg': self.disable_message,
         'enable-msg-cat': self.enable_message_category,
         'disable-msg-cat': self.disable_message_category}
     full_version = '%%prog %s, \nastng %s, common %s\nPython %s' % (
         version, astng_version, common_version, sys.version)
     OptionsManagerMixIn.__init__(self, usage=__doc__,
                                  version=full_version,
                                  config_file=pylintrc or config.PYLINTRC)
     MessagesHandlerMixIn.__init__(self)
     ReportsHandlerMixIn.__init__(self)
     BaseRawChecker.__init__(self)
     # provided reports
     self.reports = (('R0001', 'Messages by category',
                      report_total_messages_stats),
                     ('R0002', '% errors / warnings by module',
                      report_messages_by_module_stats),
                     ('R0003', 'Messages',
                      report_messages_stats),
                     ('R0004', 'Global evaluation',
                      self.report_evaluation),
                     )
     self.register_checker(self)
     self._dynamic_plugins = []
     self.load_provider_defaults()
     self.set_reporter(reporter or TextReporter(sys.stdout))
Beispiel #7
0
 def __init__(self, options=(), reporter=None, option_groups=(), pylintrc=None):
     # some stuff has to be done before ancestors initialization...
     #
     # checkers / reporter / astng manager
     self.reporter = None
     self._checkers = {}
     self._ignore_file = False
     # visit variables
     self.base_name = None
     self.base_file = None
     self.current_name = None
     self.current_file = None
     self.stats = None
     # init 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}
     full_version = "%%prog %s, \nastng %s, common %s\nPython %s" % (
         version,
         astng_version,
         common_version,
         sys.version,
     )
     OptionsManagerMixIn.__init__(self, usage=__doc__, version=full_version, config_file=pylintrc or config.PYLINTRC)
     MessagesHandlerMixIn.__init__(self)
     ReportsHandlerMixIn.__init__(self)
     BaseRawChecker.__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),
         ("RP0004", "Global evaluation", self.report_evaluation),
     )
     self.register_checker(self)
     self._dynamic_plugins = []
     self.load_provider_defaults()
     self.set_reporter(reporter or TextReporter(sys.stdout))