[code-quality] Two attribute usage checkers I'd like to see

Sylvain Thénault sylvain.thenault at logilab.fr
Thu Jun 20 10:33:18 CEST 2013


On 19 juin 10:41, Skip Montanaro wrote:
> On Wed, Jun 19, 2013 at 2:37 AM, Sylvain Thénault
> <sylvain.thenault at logilab.fr> wrote:
> > On 07 juin 09:18, Martin Pool wrote:
> >> On 7 June 2013 06:49, Skip Montanaro <skip at pobox.com> wrote:
> >>
> >> > If I never refer to self.x or self.y within the class's methods it
> >> > would be nice to be alerted.
> >> >
> >>
> >> +1, and that seems feasible to add to pylint.
> >
> > Hey guys, today is your last chance to contribute this to the pylint 10th anniversary sprint ;)
> > And to get it in forthcoming 1.0...
> >
> > Monday and tuesday reports:
> > https://www.logilab.org/blogentry/146924
> > https://www.logilab.org/blogentry/147339
> >
> > --
> > Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42)
> > Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
> > Développement logiciel sur mesure:       http://www.logilab.fr/services
> > CubicWeb, the semantic web framework:    http://www.cubicweb.org
> 
> I don't have a bunch of spare time, but can you point me in the
> general direction of where such a check would be made?  I believe
> pylint already has a "set but not used" message for local variables.
> This check could, I think, be patterned after that code.

There is an unused-variable message in the variables checker (pylint/checkers/variables.py).
This is probably worth reading indeed, though in this particular case in should rather
go in the classes checker (pylint/checkers/classes.py).

> Sorry, I wasn't aware you were sprinting.

no problem.

I will do a whole sprint report later today.

-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org


More information about the code-quality mailing list