示例#1
0
 def set_option(self, opt_name, value, action=None, opt_dict=None):
     """overridden from configuration.OptionsProviderMixin to handle some
     special options
     """
     if opt_name in self._options_methods:
         if value:
             meth = self._options_methods[opt_name]
             value = check_csv(None, opt_name, value)
             if isinstance(value, (list, tuple)):
                 for _id in value :
                     meth(_id)
             else :
                 meth(value)
     elif opt_name == 'cache-size':
         MANAGER.set_cache_size(int(value))
     elif opt_name == 'output-format':
         self.set_reporter(REPORTER_OPT_MAP[value.lower()]())
     elif opt_name in ('enable-checker', 'disable-checker'):
         if not value:
             return
         checkerids = [v.lower() for v in check_csv(None, opt_name, value)]
         self.enable_checkers(checkerids, opt_name == 'enable-checker')
     try:
         BaseRawChecker.set_option(self, opt_name, value, action, opt_dict)
     except UnsupportedAction:
         print >>sys.stderr, 'option %s can\'t be read from config file' % opt_name
示例#2
0
    def set_option(self, optname, value, action=None, optdict=None):
        """overridden from configuration.OptionsProviderMixin to handle some
        special options
        """
        if optname in self._options_methods or optname in self._bw_options_methods:
            if value:
                try:
                    meth = self._options_methods[optname]
                except KeyError:
                    meth = self._bw_options_methods[optname]
                    warn("%s is deprecated, replace it by %s" % (optname, optname.split("-")[0]), DeprecationWarning)
                value = check_csv(None, optname, value)
                if isinstance(value, (list, tuple)):
                    for _id in value:
                        meth(_id)
                else:
                    meth(value)
        elif optname == "output-format":
            if value.lower() in REPORTER_OPT_MAP:
                self.set_reporter(REPORTER_OPT_MAP[value.lower()]())
            else:
                module = load_module_from_name(get_module_part(value))
                class_name = value.split(".")[-1]
                reporter_class = getattr(module, class_name)
                self.set_reporter(reporter_class())

        try:
            BaseRawChecker.set_option(self, optname, value, action, optdict)
        except UnsupportedAction:
            print >> sys.stderr, "option %s can't be read from config file" % optname
示例#3
0
文件: lint.py 项目: Abaobo/vimrc
 def set_option(self, optname, value, action=None, optdict=None):
     """overridden from configuration.OptionsProviderMixin to handle some
     special options
     """
     if optname in self._options_methods or optname in self._bw_options_methods:
         if value:
             try:
                 meth = self._options_methods[optname]
             except KeyError:
                 meth = self._bw_options_methods[optname]
                 warn('%s is deprecated, replace it by %s' % (
                     optname, optname.split('-')[0]), DeprecationWarning)
             value = check_csv(None, optname, value)
             if isinstance(value, (list, tuple)):
                 for _id in value :
                     meth(_id)
             else :
                 meth(value)
     elif optname == 'output-format':
         self.set_reporter(REPORTER_OPT_MAP[value.lower()]())
     try:
         BaseRawChecker.set_option(self, optname, value, action, optdict)
     except UnsupportedAction:
         print >> sys.stderr, 'option %s can\'t be read from config file' % \
               optname
示例#4
0
 def set_option(self, optname, value, action=None, optdict=None):
     """overridden from configuration.OptionsProviderMixin to handle some
     special options
     """
     if optname in self._options_methods or optname in self._bw_options_methods:
         if value:
             try:
                 meth = self._options_methods[optname]
             except KeyError:
                 meth = self._bw_options_methods[optname]
                 warn(
                     '%s is deprecated, replace it by %s' %
                     (optname, optname.split('-')[0]), DeprecationWarning)
             value = check_csv(None, optname, value)
             if isinstance(value, (list, tuple)):
                 for _id in value:
                     meth(_id)
             else:
                 meth(value)
     elif optname == 'output-format':
         self.set_reporter(REPORTER_OPT_MAP[value.lower()]())
     try:
         BaseRawChecker.set_option(self, optname, value, action, optdict)
     except UnsupportedAction:
         print >> sys.stderr, 'option %s can\'t be read from config file' % \
               optname
 def set_option(self, opt_name, value, action=None, opt_dict=None):
     """overridden from configuration.OptionsProviderMixin to handle some
     special options
     """
     if opt_name in self._options_methods:
         if value:
             meth = self._options_methods[opt_name]
             value = check_csv(None, opt_name, value)
             if isinstance(value, (list, tuple)):
                 for _id in value:
                     meth(_id)
             else:
                 meth(value)
     elif opt_name == 'output-format':
         self.set_reporter(REPORTER_OPT_MAP[value.lower()]())
     elif opt_name in ('enable-checker', 'disable-checker'):
         if not value:
             return
         checkerids = [v.lower() for v in check_csv(None, opt_name, value)]
         self.enable_checkers(checkerids, opt_name == 'enable-checker')
     try:
         BaseRawChecker.set_option(self, opt_name, value, action, opt_dict)
     except UnsupportedAction:
         print >> sys.stderr, 'option %s can\'t be read from config file' % \
               opt_name
示例#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._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': 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))
示例#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.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))
示例#8
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))
示例#9
0
 def __init__(self, linter=None):
     BaseRawChecker.__init__(self, linter)
     self._lines = None
     self._visited_lines = None
示例#10
0
文件: format.py 项目: DINKIN/XDM
 def __init__(self, linter=None):
     BaseRawChecker.__init__(self, linter)
     self._lines = None
     self._visited_lines = None
示例#11
0
 def __init__(self, linter):
     BaseRawChecker.__init__(self, linter)
     self.stats = None
示例#12
0
 def __init__(self, linter):
     BaseRawChecker.__init__(self, linter)
     self.stats = None