qutip/qutip-qip

View on GitHub

Showing 26 of 174 total issues

Avoid deeply nested control flow statements.
Open

                        if end == gate.controls[0]:
                            temp.gates.append(
                                Gate(
                                    gate.name,
                                    targets=[i + 1],
Severity: Major
Found in src/qutip_qip/circuit/circuit.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if start + end - i - i == 1 and (end - start + 1) % 2 == 0:
                            qc_t.add_gate(gate.name, [i, i + 1])
                        elif (start + end - i - i) == 2 and (
                            end - start + 1
                        ) % 2 == 1:
    Severity: Major
    Found in src/qutip_qip/transpiler/chain.py - About 45 mins to fix

      Function _concatenate_pulses has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
      Open

          def _concatenate_pulses(
              self, pulse_instructions, scheduled_start_time, num_controls
          ):
              """
              Concatenate compiled pulses coefficients and tlist for each pulse.
      Severity: Minor
      Found in src/qutip_qip/compiler/gatecompiler.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 _get_qobjevo_helper has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
      Open

          def _get_qobjevo_helper(self, spline_kind, dims):
              """
              Please refer to `_Evoelement.get_qobjevo` for documentation.
              """
              mat = self.get_qobj(dims)
      Severity: Minor
      Found in src/qutip_qip/pulse.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 generate_dependency_graph has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
      Open

          def generate_dependency_graph(self, commuting):
              """
              Generate the instruction dependency graph.
              It modifies the class attribute `nodes`, where each element (node)
              is an `Instruction`.
      Severity: Minor
      Found in src/qutip_qip/compiler/scheduler.py - About 25 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 _is_pulses_valid has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
      Open

          def _is_pulses_valid(self):
              """
              Check if the pulses are in the correct shape.
      
              Returns: bool
      Severity: Minor
      Found in src/qutip_qip/device/processor.py - About 25 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