I'm trying to fix all pylint warnings for my code, and there is just one that I cannot fix without disabling the warning or renaming the script:
C: 1, 0: Invalid module name "foo-bar" (invalid-name)
Renaming the script is not an option since its name is its public interface. The script is widely used under the current name.
That's a top-level program. The file is not intended to be used as a module. If I decide to import it as a module for unit tests, I can use __import__("foo-bar")
but no other import is supported.
Is there any nice way to tell pylint that it's a top-level script, not a module?
You need to override the module-rgx
option either at the CLI or in your pylintrc file to allow -
s. For more on this check out the docs.