[Openstack] Jenkins - nova-pylint-errors

Alex Meade alex.meade at rackspace.com
Mon Jun 6 13:08:16 UTC 2011


I've been working on cleaning up pylint errors and have a concern regarding:

E1101: %s %r has no %r member
Used when a variable is accessed for an unexistent member.

97 (59%) of the 169 errors in the nova pylint errors job on jenkins are of the type E1101. 82/97 are located under the sqlalchemy directory. This is (mostly) because pylint doesn't understand most of the ways classes and functions in the database code are getting members even though they are by no means incorrect.

One example that pylint complains about is this:

nova/db/sqlalchemy/api.py

       Class 'Network' has no 'fixed_ips' member

       1322        @require_admin_context
       1323        def network_get_by_instance(_context, instance_id):
       1324            session = get_session()
       1325            rv = session.query(models.Network).\
       1326                         filter_by(deleted=False).\
!!!!!  1327                         join(models.Network.fixed_ips).\
       1328                         filter_by(instance_id=instance_id).\
       1329                         filter_by(deleted=False).\
       1330                         first()

But Network does have the attribute fixed_ips because it is created here:

nova/db/sqlalchemy/models.py
536: network = relationship(Network, backref=backref('fixed_ips'))


What do you guys think about setting jenkins to ignore E1101 or at least ignore it for nova/db/sqlalchemy? If we ever want to get our pylint errors down to zero so we can start enforcing it, we need to either do something like above or insert pylint ignore statements throughout all the code where the error is not really an error.





More information about the Openstack mailing list