-->

How do I disable a Pylint specific error message g

2020-08-13 06:33发布

问题:

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.

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?

回答1:

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.



回答2:

pylint --generate-rcfile > ~/.pylintrc

Then add "disable": "C0103" to this file.



回答3:

Alternative add disable=C0103 to .pylintrc this will ignore for the current directory or workspace.