Running pylint on a file containing variables such as x or l will raise an error, though these variables might be meaningful in the context that they're in.

I could disable all such errors by adding the following to pyproject.toml:

[tool.pylint."MESSAGES CONTROL"] disable = [ "invalid-name"] 

But I would prefer to be able to instead explicitly state the variables that I would like to ignore.

2

2 Answers

While searching for the same issue, I found , which explains that square braces cannot be used. Rather, a comma separated list of values, wrapped in quotes will work:

[tool.pylint.'MESSAGES CONTROL'] max-line-length = 120 disable = "too-many-arguments,not-callable" 

Or, triple-quotes can be used for readability with many disable statements:

[tool.pylint.'MESSAGES CONTROL'] max-line-length = 120 disable = """ too-many-arguments, not-callable """ 
3

To ignore pylint errors for particular variable names the good-names list can be set within pyproject.toml as follows:

[tool.pylint."MESSAGES CONTROL"] good-names = [ "x", "y", ] 

Which will make x and y valid variable names for pylint.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.