#30 Suppress "No class attribute" for mixin classes

closed-accepted
nobody
None
5
2007-04-23
2007-02-22
mostlybrian
No

Hi,

Attached is a very simple patch to add a new configuration item to _allow_ suppression of "No class attribute found" - in particular circumstances.

I have some mixin classes & I want to suppress the warning ONLY for those attributes that I have explicitedly referenced (IMO pylint's "mixin" postfix means ALL attributes would get suppressed, so a real error could creep in).

Here's my example usage - a.py:

class Foo:
def __init__(self):
self.foo = 1
print self.name
self.magic()

def callback(self,now):
print "HELLO"

and the corresponding .pycheckrc entry

suppressions = {
'a.Foo.callback' : 'unusednames=now',
'a.Foo' : 'missingattrs=magic,name'
}

Hope it proves useful!

Discussion

  • mostlybrian
    mostlybrian
    2007-02-22

    Patch to add --missingattrs=foo,bar

     
  • Neal Norwitz
    Neal Norwitz
    2007-04-23

    Logged In: YES
    user_id=33168
    Originator: NO

    Thanks for the patch! (even if you did get it backwards :-)

    Maybe I'll even get a new version shipped soon.

     
  • Neal Norwitz
    Neal Norwitz
    2007-04-23

    • status: open --> closed-accepted