mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-14 05:00:13 +02:00
chore(ruff): Enable RET rules and add explicit fallbacks
Adopt Ruff `RET` to improve return-flow consistency across the codebase. Simplify control flow by removing redundant `else` blocks after `return`, and add explicit `return None` (or equivalent) fallbacks where appropriate to preserve existing behavior. Fixes #21411
This commit is contained in:
committed by
Jeremy Stretch
parent
b22e490847
commit
ef52ac4203
@@ -252,8 +252,7 @@ class VMInterfaceImportForm(OwnerCSVMixin, NetBoxModelImportForm):
|
||||
# Make sure enabled is True when it's not included in the uploaded data
|
||||
if 'enabled' not in self.data:
|
||||
return True
|
||||
else:
|
||||
return self.cleaned_data['enabled']
|
||||
return self.cleaned_data['enabled']
|
||||
|
||||
|
||||
class VirtualDiskImportForm(OwnerCSVMixin, NetBoxModelImportForm):
|
||||
|
||||
@@ -260,12 +260,11 @@ class VirtualMachine(ContactsMixin, ImageAttachmentsMixin, RenderConfigMixin, Co
|
||||
def primary_ip(self):
|
||||
if get_config().PREFER_IPV4 and self.primary_ip4:
|
||||
return self.primary_ip4
|
||||
elif self.primary_ip6:
|
||||
if self.primary_ip6:
|
||||
return self.primary_ip6
|
||||
elif self.primary_ip4:
|
||||
if self.primary_ip4:
|
||||
return self.primary_ip4
|
||||
else:
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user