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],
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:
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.
- 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 _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)
- 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 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`.
- 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 _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
- 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"