Pylint - how to skip invalid-name module error

Viewed 151

How could I skip this error without changing the module name?

Module name AaB doesn't conform to snake_case naming style ('[^\\W\\dA-Z][^\\WA-Z]*$' pattern) (invalid-name)

I tried, at the beginning of the module

# pylint: disable-all

And

# pylint: disable=invalid-name

Also I tried to configure in the .pylintrc file:

ignore-patterns=AaB.py

What else could I try?

1 Answers

Try adding this to the end of the line

# pylint: disable=C0103

Or, if you're using VSCode, try adding this to your settings.json

"python.linting.pylintArgs": ["--disable={c0103}"]

The snake_case naming style is opposite to the camel case naming style. The difference between them is what you use to replace a space, an underscore or an uppercase.

Take the name button position for example:

snake_case camel case
button_position ButtonPosition

C1013 means that the name you're using doesn't fit the naming convention, which, in pylint, is the snake_case naming style. Using the camel case is acceptable, but the snake_case is more readable.

Related