[Dev] PyLint report on Chandler

Phillip J. Eby pje at telecommunity.com
Fri Sep 16 10:22:54 PDT 2005


At 09:32 AM 9/16/2005 -0700, Heikki Toivonen wrote:
>I just got pylint installed properly (I think) and managed to run it
>over (hopefully) all of Chandler. It found quite a bit to complain :)
>
>I posted the log here:
>https://bugzilla.osafoundation.org/attachment.cgi?id=994&action=view
>(bug 1824).
>
>It would be great if you could go and check areas of code you are in
>charge of and check whether or not those reported problems are real.
>
>Some words of warning:
>
>Think about the report before changing anything. If you think the report
>is correct and you make a change, run Chandler and tests to make sure
>the code was not relying on some side effect PyLint did not notice.

I took a detailed look at it for application.schema, and skimmed the 
rest.  I found exactly one useful item out of over 60 warnings and errors 
in the list for application.schema.  (It correctly identifies one unused 
import.)  Codes E0214, W0613, and W0621 in particular were frequent and 
utterly useless.

W0232 is not only useless, but dangerous: most Chandler item classes should 
*not* have __init__ methods; please don't add them on the basis of this 
warning.  (Ideally, no Item subclass should have its own __init__ method, 
and to the extent that we need them, we need to do more work on the schema 
and/or repository APIs.)

W0232's corollary is W0201, which is always going to show up with Item 
subclasses that don't initialize attributes in __init__ - which should be 
*all* of them.  So there's little point in paying attention to this one 
either.  (E0201 *may* also be noise in the same way, since it's going to 
show up if you never assign to an attribute in the class.)


>Still, having said all that, just a cursory look at the warnings seems
>to show plenty of genuine stuff like unused imports and variables, bad
>indents, using undefined variables, and so forth.

Unused imports and bad indents are good information, as is "Dangerous 
default value {} as argument".

This is just a cursory review of the warnings.  Based on my initial 
impression, I'd say that for everybody to use this report (as currently 
constructed) is probably a waste of time.  At minimum, the codes I listed 
above should be suppressed in order to clear away some of the noise and 
misleading implied suggestions that appear to constitute the bulk of the 
output.

Please note also that just because I haven't said a particular warning is 
bad, doesn't mean that the warning is good.  It probably just means I 
haven't seen enough occurrences of the message to bother checking it 
out.  There are also warnings that are not "wrong" in the sense that they 
correctly point out things about the code, but also provide no reason for 
changing.  For example, W0403, W0331, W0141, and W0142 are sort of like 
saying, "hey, you wrote some code here", or "you used a variable name 
starting with the letter 'b'".  That is, it's not clear why PyLint even 
bothers to point these out.



More information about the Dev mailing list