0

I'd like to disable the pylint warning for invalid-name only for the module name.

The warning is: Module name "some-module-name" doesn't conform to camelCase naming style

I can disable the message by putting # pylint: disable=invalid-name at the top of the file, but this unfortunately disables all invalid-name errors, not just for the module.

Is there a way to disable the module invalid-name warning only?

Vasseurth
  • 6,354
  • 12
  • 53
  • 81
  • 1
    I believe someone has answered your question already. https://stackoverflow.com/questions/28829236/is-it-possible-to-ignore-one-single-specific-line-with-pylint – lua_python_java Aug 22 '22 at 22:15

2 Answers2

1

While the question linked in the comments wasn't quite the same, it gave me an idea on how to solve it (perhaps in an unintended manner).

At the top of the file I place a disable & enable one after the other. This disables module-level invalid-name but re-enables so that other level checks are still active.

# pylint: disable=invalid-name
# pylint: enable=invalid-name
Vasseurth
  • 6,354
  • 12
  • 53
  • 81
0

You could use the module-naming-style option of pylint, setting it to "any" (rather than "snake_case" or "cameCase"), either via command-line:

$ pylint --module-naming-style=any src/

Or via .pylintrc file (if you have one):

$ pylint --generate-rcfile > .pylintrc
$ grep "module-naming-style" .pylintrc
module-naming-style=any

For more details see: https://pylint.pycqa.org/en/1.7/user_guide/options.html#predefined-naming-styles

Paolo Rovelli
  • 9,396
  • 2
  • 58
  • 37