Showing 21 of 21 total issues
Function update_move_3pin_net
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def update_move_3pin_net(self, part, move_info):
"""Update move for 3-pin net
The function `update_move_3pin_net` updates the move for a 3-pin net in a graph.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function purge_duplicate_nets
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def purge_duplicate_nets(hyprgraph: Netlist, ugraph, nets, num_clusters, num_modules):
"""
The function `purge_duplicate_nets` removes duplicate nets from a graph and returns the updated net
weights and list of nets.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File FMKWayGainCalc.py
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
# type: ignore
from itertools import permutations
from typing import Any, Dict, List, Union
Function update_move_general_net
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def update_move_general_net(self, part, move_info):
"""Update move for general net
The function `update_move_general_net` updates the move for a general net in a graph partitioning
algorithm.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _init_gain_general_net
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _init_gain_general_net(self, net, part: Part):
"""
The function `_init_gain_general_net` initializes the gain for a general net based on the number of
connections to each partition.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _init_gain_general_net
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _init_gain_general_net(self, net, part: Part) -> None:
"""
The function `_init_gain_general_net` initializes the gain for a general net based on the number of
connections to each partition.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _init_gain_3pin_net
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _init_gain_3pin_net(self, net, part: Part):
"""
The function `_init_gain_3pin_net` initializes the gain for a 3-pin net in a graph.
:param net: The `net` parameter represents a node in a graph. It is of type `node_t`
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _optimize_1pass
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _optimize_1pass(self, part: Part):
"""
The `_optimize_1pass` function optimizes the placement of parts by selecting moves with the maximum
gain and updating the placement accordingly.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update_move_general_net
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_move_general_net(self, part, move_info):
"""
The function `update_move_general_net` updates the move for a general net in a graph based on the
given move information.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update_move
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_move(self, part, move_info_v):
"""
The function `update_move` updates the gain of a move in a graph based on the given move
information.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if set1 == set2: # expensive operation for high-pin nets
same = True
if same:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function restore_part_info
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def restore_part_info(self, snapshot, part: Part):
"""
The function `restore_part_info` takes a snapshot and updates the attributes of a `Part` object
based on the snapshot.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
for k in range(self.num_parts):
self.delta_gain_v[k] -= weight
weight = -weight
Function _init_gain_3pin_net
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _init_gain_3pin_net(self, net, part: Part):
"""
The function initializes the gain for a 3-pin net based on the parts assigned to each pin.
:param net: The `net` parameter is a `node_t` object, which represents a net in a circuit. It is
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function reconstruct_graph
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def reconstruct_graph(hyprgraph: Netlist, ugraph, nets, num_clusters, num_modules):
Function purge_duplicate_nets
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def purge_duplicate_nets(hyprgraph: Netlist, ugraph, nets, num_clusters, num_modules):
Function legalize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def legalize(self, part: Part):
"""
The `legalize` function is used to perform a legalization process on a given part in a graph.
:param part: The `part` parameter represents the current partitioning of the modules. It is a data
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function run_MLBiPartMgr
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run_MLBiPartMgr(hyprgraph: Netlist):
part_mgr = MLBiPartMgr(0.4)
mincost = 100000000000
minpart = []
for _ in range(10):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update_move_2pin_net
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_move_2pin_net(self, part, move_info):
"""Update move for 2-pin net
The function `update_move_2pin_net` updates the move for a 2-pin net in a graph.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"