I am trying to understand why pylint treats module-level global variables
as constants when checking the validity of their names. I though pylint
followed PEP8 but if I look here:
https://www.python.org/dev/peps/pep-0008/#id42 I see that global variables
should follow the same format as function names (with some caveats about
beginning with a "_" or being protected by __all__).
Is the problem that it is difficult to determine whether a module-level
variable is a constant or a global variable, so it was decided to err on
the side of constants since use of global variables is generally
discouraged and the invalid-name check can be locally disabled for the few
global variables that are needed?
Where can i find a bare minimum pylint checker that will successfully be
registered and called?
I've tried to write a checker like so:
$ cat mychecker.py
from pylint import checkers
name = "FooBar"
def visit_module(self, node):
def visit_importfrom(self, node):
def visit_import(self, node):
print "Mychecker registered successfully it seems"
I get the print from register but neither of my visit_* methods seems to
get called, i cannot see why.
I run it like so:
PYTHONPATH=. pylint --load-plugins=mychecker -rn main.py testmodule
What am i missing?