当前位置: 首页>>代码示例>>Python>>正文


Python PyLinter.load_configuration_from_config方法代码示例

本文整理汇总了Python中pylint.lint.PyLinter.load_configuration_from_config方法的典型用法代码示例。如果您正苦于以下问题:Python PyLinter.load_configuration_from_config方法的具体用法?Python PyLinter.load_configuration_from_config怎么用?Python PyLinter.load_configuration_from_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pylint.lint.PyLinter的用法示例。


在下文中一共展示了PyLinter.load_configuration_from_config方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_pylint

# 需要导入模块: from pylint.lint import PyLinter [as 别名]
# 或者: from pylint.lint.PyLinter import load_configuration_from_config [as 别名]
    def check_pylint(self):
        """
        Check using pylint.
        """
        options = self.options.get('pylint', self.file_path).copy()
        if not options['enabled']:
            return
        del options['enabled']

        if not self._compiled_tree:
            # We failed to compile the tree.
            return

        from pylint.lint import PyLinter, fix_import_path
        from pylint.reporters import CollectingReporter

        linter = PyLinter()
        linter.load_default_plugins()
        linter.set_reporter(CollectingReporter())

        if options['py3k']:
            linter.python3_porting_mode()
        del options['py3k']

        rcfile = options.get('rcfile', None)
        del options['rcfile']

        if rcfile:
            linter.read_config_file(config_file=rcfile)
            linter.load_config_file()
        else:
            linter.load_configuration_from_config(options)

        # PyLint does its own import and parsing, so we only pass the file
        # name and the precompiled tree.
        with fix_import_path(self.file_path):
            linter.check(self.file_path)

        for message in linter.reporter.messages:
            self.message(
                message.line,
                '%s:%s %s' % (
                    message.msg_id,
                    message.symbol,
                    message.msg,
                    ),
                code=message.msg_id,
                icon='info',
                category='pylint',
                )
开发者ID:chevah,项目名称:pocket-lint,代码行数:52,代码来源:formatcheck.py


注:本文中的pylint.lint.PyLinter.load_configuration_from_config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。