luk036/ckpttnpy

View on GitHub

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.

Severity: Minor
Found in src/ckpttnpy/FMKWayGainCalc.py - About 5 hrs to fix

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.
Severity: Minor
Found in src/ckpttnpy/min_cover.py - About 4 hrs to fix

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

Severity: Minor
Found in src/ckpttnpy/FMKWayGainCalc.py - About 3 hrs to fix

    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.
    Severity: Minor
    Found in src/ckpttnpy/FMKWayGainCalc.py - About 2 hrs to fix

    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.
    
    
    Severity: Minor
    Found in src/ckpttnpy/FMKWayGainCalc.py - About 1 hr to fix

    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.
    
    
    Severity: Minor
    Found in src/ckpttnpy/FMBiGainCalc.py - About 1 hr to fix

    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`
    Severity: Minor
    Found in src/ckpttnpy/FMKWayGainCalc.py - About 1 hr to fix

    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.
    
    
    Severity: Minor
    Found in src/ckpttnpy/PartMgrBase.py - About 1 hr to fix

    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.
    
    
    Severity: Minor
    Found in src/ckpttnpy/FMBiGainCalc.py - About 1 hr to fix

    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.
    
    
    Severity: Minor
    Found in src/ckpttnpy/FMGainMgr.py - About 1 hr to fix

    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:
    Severity: Major
    Found in src/ckpttnpy/min_cover.py - About 45 mins to fix

      Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Minor
      Found in src/ckpttnpy/MLPartMgr.py - About 45 mins to fix

        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.
        
        
        Severity: Minor
        Found in src/ckpttnpy/FMPartMgr.py - About 45 mins to fix

        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
        Severity: Major
        Found in src/ckpttnpy/FMKWayGainCalc.py - About 45 mins to fix

          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
          Severity: Minor
          Found in src/ckpttnpy/FMBiGainCalc.py - About 45 mins to fix

          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):
          Severity: Minor
          Found in src/ckpttnpy/min_cover.py - About 35 mins to fix

            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):
            Severity: Minor
            Found in src/ckpttnpy/min_cover.py - About 35 mins to fix

              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
              Severity: Minor
              Found in src/ckpttnpy/PartMgrBase.py - About 35 mins to fix

              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):
              Severity: Minor
              Found in experiments/plot_random_part.py - About 35 mins to fix

              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.
              
              
              Severity: Minor
              Found in src/ckpttnpy/FMKWayGainCalc.py - About 35 mins to fix

              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

              Severity
              Category
              Status
              Source
              Language