Enable the PLR1704 lint in Ruff

This commit is contained in:
Adam Turner 2024-10-19 02:37:57 +01:00
parent 4d2d2e4481
commit 9364c0cf6a
2 changed files with 4 additions and 5 deletions

View File

@ -48,7 +48,6 @@ ignore = [
"PLR0916", # Too many Boolean expressions ({expressions} > {max_expressions}) "PLR0916", # Too many Boolean expressions ({expressions} > {max_expressions})
"PLR0917", # Too many positional arguments ({c_pos}/{max_pos}) "PLR0917", # Too many positional arguments ({c_pos}/{max_pos})
"PLR1702", # Too many nested blocks ({nested_blocks} > {max_nested_blocks}) "PLR1702", # Too many nested blocks ({nested_blocks} > {max_nested_blocks})
"PLR1704", # Redefining argument with the local name `{name}`
"PLR1714", # Consider merging multiple comparisons: `{expression}`. Use a `set` if the elements are hashable. "PLR1714", # Consider merging multiple comparisons: `{expression}`. Use a `set` if the elements are hashable.
"PLR2004", # Magic value used in comparison, consider replacing `{value}` with a constant variable "PLR2004", # Magic value used in comparison, consider replacing `{value}` with a constant variable
"PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation "PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation

View File

@ -312,19 +312,19 @@ class InheritanceGraph:
self._format_graph_attrs(g_attrs), self._format_graph_attrs(g_attrs),
] ]
for name, fullname, bases, tooltip in sorted(self.class_info): for cls_name, fullname, bases, tooltip in sorted(self.class_info):
# Write the node # Write the node
this_node_attrs = n_attrs.copy() this_node_attrs = n_attrs.copy()
if fullname in urls: if fullname in urls:
this_node_attrs["URL"] = '"%s"' % urls[fullname] this_node_attrs["URL"] = f'"{urls[fullname]}"'
this_node_attrs["target"] = '"_top"' this_node_attrs["target"] = '"_top"'
if tooltip: if tooltip:
this_node_attrs["tooltip"] = tooltip this_node_attrs["tooltip"] = tooltip
res.append(' "%s" [%s];\n' % (name, self._format_node_attrs(this_node_attrs))) res.append(f' "{cls_name}" [{self._format_node_attrs(this_node_attrs)}];\n')
# Write the edges # Write the edges
res.extend( res.extend(
' "%s" -> "%s" [%s];\n' % (base_name, name, self._format_node_attrs(e_attrs)) f' "{base_name}" -> "{cls_name}" [{self._format_node_attrs(e_attrs)}];\n'
for base_name in bases for base_name in bases
) )
res.append("}\n") res.append("}\n")