pychecker stories/feedback?
David Kovalsky
dkovalsk at redhat.com
Tue Apr 29 11:04:56 UTC 2008
On Fri, 25 Apr 2008 13:10:18 +0000
James Laska <jlaska at redhat.com> wrote:
> I've been playing around with a side project of using pychecker to
> provide early warning of typos/thinkos and questionable practices.
> I'm basically looking for many of the benefits that a compiler
> provides when it can't resolve find a variable/class/function name
> etc...
>
> I've got the right mix of pychecker cmdline args such that the subset
> of issues is now manageable. But I'm curious if folks have any
> general thoughts on this subject.
>
> What are your best practices?
>
> Are there other similar tools out there?
>
> Have any experiences to share or words of caution/wisdom?
Hey James,
I've been using pylint for a while and I must say it's pretty useful.
It takes a while though to tune some of the tests - like
* every variable has to be at least 3 chars (except for i when
iterating), so often used 'id' won't pass as well as common for l in
lines, for k,v in dict.iteritems() and such
* pylint complains about nonexisting properties if you override the
__getattr__ method.
* in default * and ** magic is now allowed (from foo import *, def
bar(*args, **kwargs), which is sometimes very useful
But it has pretty good documentation, commented config file and you can
tune the checks using comments in the .py files themselves
to disable a check for a file or even a block of code as simply as for
example '# pylint: disable-msg=C0103' to disable warning about module
variable in lowercase.
As I mentioned, you really have to take the time to configure it to
your standart. As some people prefer to use CamelCase, some
use_underline. After that is helps you keep the same standart
throughout the whole project. And writing your own tests (plugins) is
easy and fun :)
HTH,
/David
--
===================================================================
David Kovalsky dkovalsk at redhat.com
Quality Engineer & EUS (z-stream) QE point person
Red Hat Czech s.r.o. Brno, Czech Republic
tel: +420 532 294 223
mobile: +420 777 707 369
IRC: #0day, #brno, #errata, #qa, #rhlp, #tps, #urt
===================================================================
More information about the python-devel
mailing list