禁用文件的所有 Pylint 警告 [英] Disable all Pylint warnings for a file

查看:48
本文介绍了禁用文件的所有 Pylint 警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在构建系统中使用 Pylint.

We are using Pylint within our build system.

我们的代码库中有一个 Python 包,其中包含一次性代码,我想暂时禁用模块的所有警告,这样我就可以停止用这些多余的消息干扰其他开发人员.有没有一种简单的方法来pylint: disable 模块的所有警告?

We have a Python package within our code base that has throwaway code, and I'd like to disable all warnings for a module temporarily so I can stop bugging the other devs with these superfluous messages. Is there an easy way to pylint: disable all warnings for a module?

推荐答案

来自 Pylint 常见问题:

使用 Pylint <0.25,添加

With Pylint < 0.25, add

# pylint: disable-all

在模块的开头.

Pylint 0.26.1 及更高版本已将该指令重命名为

Pylint 0.26.1 and up have renamed that directive to

# pylint: skip-file

(但为了向后兼容,将保留第一个版本).

(but the first version will be kept for backward compatibility).

为了便于查找哪些模块被忽略,会发出信息级消息 I0013.对于最新版本的 Pylint,如果您使用旧语法,则会发出额外的 I0014 消息.

In order to ease finding which modules are ignored a information-level message I0013 is emitted. With recent versions of Pylint, if you use the old syntax, an additional I0014 message is emitted.

这篇关于禁用文件的所有 Pylint 警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆