oVirt / vdsm

The Virtual Desktop Server Manager
GNU General Public License v2.0
160 stars 201 forks source link

pylint: ignore no-member #321

Closed aesteve-rh closed 1 year ago

aesteve-rh commented 1 year ago

A few classes in vm devices use __slots__ to define class attributes that are not properly detected by pylint, causing false positive no-member errors:

lib/vdsm/virt/vmdevices/lease.py:175:46: E1101: Instance of 'Device' has no 'lease_id' member (no-member)
lib/vdsm/virt/vmdevices/lease.py:176:52: E1101: Instance of 'Device' has no 'sd_id' member (no-member)
...
lib/vdsm/virt/vmdevices/network.py:55:32: E1101: Instance of 'Interface' has no 'macAddr' member (no-member)
lib/vdsm/virt/vmdevices/network.py:153:29: E1101: Instance of 'Interface' has no 'device' member (no-member)
...
lib/vdsm/virt/vmdevices/storage.py:239:47: E1101: Instance of 'Drive' has no 'index' member (no-member)
lib/vdsm/virt/vmdevices/storage.py:239:47: E1101: Instance of 'Drive' has no 'iface' member (no-member)
...

Since no-member is an interesting error that we do not want to disable project-wide, better to just add pylint ignore comments in the classes that use this strategy.

Signed-off-by: Albert Esteve aesteve@redhat.com

aesteve-rh commented 1 year ago

Pylint issues seen in: https://github.com/oVirt/vdsm/actions/runs/3125767831/jobs/5070498445

aesteve-rh commented 1 year ago

no-member is a pylint Error, and is globally enabled (with all the other errors) in this line: https://github.com/oVirt/vdsm/blob/master/pylintrc#L68

But then I was looking for the place where this is disabled in current code, and turns they are already ignored in the affected files: https://github.com/oVirt/vdsm/blob/master/lib/vdsm/virt/vmdevices/lease.py#L20

I will close this PR and handle it in the copyright branch, that is mistakenly removing this line.