Closes #18022: Extend linter (ruff) to enforce line length limit (120 chars) (#18067)

* Enable E501 rule
* Configure ruff formatter
* Reformat migration files to fix line length violations
* Fix various E501 errors
* Move table template code to template_code.py & ignore E501 errors
* Reformat raw SQL
This commit is contained in:
Jeremy Stretch
2024-11-21 15:58:11 -05:00
committed by GitHub
parent f08e36e538
commit 343a4af591
200 changed files with 5928 additions and 1670 deletions

View File

@@ -532,7 +532,10 @@ def update_interface_bridges(device, interface_templates, module=None):
interface = Interface.objects.get(device=device, name=interface_template.resolve_name(module=module))
if interface_template.bridge:
interface.bridge = Interface.objects.get(device=device, name=interface_template.bridge.resolve_name(module=module))
interface.bridge = Interface.objects.get(
device=device,
name=interface_template.bridge.resolve_name(module=module)
)
interface.full_clean()
interface.save()
@@ -909,7 +912,10 @@ class Device(
})
if self.primary_ip4.assigned_object in vc_interfaces:
pass
elif self.primary_ip4.nat_inside is not None and self.primary_ip4.nat_inside.assigned_object in vc_interfaces:
elif (
self.primary_ip4.nat_inside is not None and
self.primary_ip4.nat_inside.assigned_object in vc_interfaces
):
pass
else:
raise ValidationError({
@@ -924,7 +930,10 @@ class Device(
})
if self.primary_ip6.assigned_object in vc_interfaces:
pass
elif self.primary_ip6.nat_inside is not None and self.primary_ip6.nat_inside.assigned_object in vc_interfaces:
elif (
self.primary_ip6.nat_inside is not None and
self.primary_ip6.nat_inside.assigned_object in vc_interfaces
):
pass
else:
raise ValidationError({
@@ -978,9 +987,10 @@ class Device(
if hasattr(self, 'vc_master_for') and self.vc_master_for and self.vc_master_for != self.virtual_chassis:
raise ValidationError({
'virtual_chassis': _('Device cannot be removed from virtual chassis {virtual_chassis} because it is currently designated as its master.').format(
virtual_chassis=self.vc_master_for
)
'virtual_chassis': _(
'Device cannot be removed from virtual chassis {virtual_chassis} because it is currently '
'designated as its master.'
).format(virtual_chassis=self.vc_master_for)
})
def _instantiate_components(self, queryset, bulk_create=True):