On Sat, Aug 13, 2016 at 11:31 AM, mrx <patrik....@gmail.com> wrote: > Hi, > > 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 > import pdb > > class Foo(checkers.BaseChecker): > > name = "FooBar" > > def visit_module(self, node): > self.add_message('blaha-name', node=node) > pdb.set_trace() > > def visit_importfrom(self, node): > self.add_message('foo-name', node=node) > pdb.set_trace() > > def visit_import(self, node): > self.add_message('bar-name', node=node) > pdb.set_trace() > > def register(linter): > linter.register_checker(Foo(linter)) > 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? > > >
Hi, You will have to provide as well the message dictionary that you checker is going to emit. I just documented this here: https://docs.pylint.org/en/latest/custom_checkers.html#writing-your-own-checker This part needs more documentation work though, so if you notice any other inconsistency, let me know. Claudiu
_______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality