[Python-projects] get new message ids in pylint?

Sylvain Thénault sylvain.thenault at logilab.fr
Mon Feb 9 21:46:44 CET 2009


Le Monday 09 February 2009 14:02:15 Saegebrecht Martin, vous avez écrit :
> Hello.

Hello,

> I have successfully created my own checker. The next step is to add
> messages in the report everytime my checker encounters an error.
>
> My question is how do I create new message-ids for my own custom errors
> that I want to fill my report with?

each checker has a .msgs attribute which is a dictionary with message id as 
key and a 2-uple as value, where the first item is the message string (which 
can contains substitution string, eg %s, which will be replaced according to 
the args argument of add_message), and the second item is a string describing 
when/why this message  occurrs.

Now a message id is usually constructed on the following pattern:

  <message type><checker id><message id>

where:

* <message type> a single capitalized letter; one of E(rror), W(arning), 
C(onvention), R(efactor). There is also F(atal) and I(nformation) but those 
should be used for message about the lint process

* <checker id> two digits identifying the checker (consider 01..20 as reserved 
for builtins checkers)

* <message id> two digits identifying the message (though only the whole 
message id should be unique, not this part)

-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Python et calcul scientifique:           http://www.logilab.fr/science


More information about the Python-Projects mailing list