如何全局禁用Pylint特定错误消息? [英] How do I disable a Pylint specific error message globally?
问题描述
我将Sublime Text编辑器与Pylint用作Python代码解析器。它工作正常,但是无论何时定义变量,我都会收到以下错误消息(C0103):
I'm using Sublime Text editor with Pylint as a Python code parser. It works fine, BUT whenever I define a variable, I receive the following error message (C0103):
错误:无效的常量名称。
Error: invalid constant name.
我读了在该主题中一个解决方案可能是添加#pylint:disable-msg = C0103
到源代码,但是这种解决方案对我来说还不够,因为我有很多变量定义,而且我不想用对Pylint的调用来污染我的代码。我需要全局禁用所有Python源文件中的错误消息C0103。我必须永远摆脱这条信息。我该怎么做?
I read in this topic that one solution could be adding a # pylint: disable-msg=C0103
to the source code, but this solution isn't enough for me because I have a lot of variable definitions and I don't want to polute my code with calls to Pylint. I need to disable error message C0103 for good, globally, in ALL my Python's source files. I must get rid of this message forever. How can I accomplish this?
推荐答案
为使pylint自动提取rc文件,它应位于〜/ .pylintrc
。否则,每次调用pylint时,都需要将rc文件作为参数传递。
In order for pylint to automatically pick up your rc file, it should be located at ~/.pylintrc
. Otherwise you would need to pass the rc file as an argument on every invocation of pylint.
这篇关于如何全局禁用Pylint特定错误消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!