Showing 325 of 325 total issues

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

def steadystate(A, c_ops=[], *, method='direct', solver=None, **kwargs):
    """
    Calculates the steady state for quantum evolution subject to the supplied
    Hamiltonian or Liouvillian operator and (if given a Hamiltonian) a list of
    collapse operators.
Severity: Minor
Found in qutip/solver/steadystate.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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

    blocks_list = [
        (2 * (i + 1 * (N % 2)) + 1 * ((N + 1) % 2))
        for i in range(blocks_dimensions)
Severity: Minor
Found in qutip/piqs/piqs.py and 2 other locations - About 35 mins to fix
qutip/piqs/piqs.py on lines 219..221
qutip/piqs/piqs.py on lines 1493..1495

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

    blocks_list = [
        (2 * (i + 1 * (N % 2)) + 1 * ((N + 1) % 2))
        for i in range(blocks_dimensions)
Severity: Minor
Found in qutip/piqs/piqs.py and 2 other locations - About 35 mins to fix
qutip/piqs/piqs.py on lines 180..182
qutip/piqs/piqs.py on lines 1493..1495

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

    blocks_list = [
        (2 * (i + 1 * (N % 2)) + 1 * ((N + 1) % 2))
        for i in range(blocks_dimensions)
Severity: Minor
Found in qutip/piqs/piqs.py and 2 other locations - About 35 mins to fix
qutip/piqs/piqs.py on lines 180..182
qutip/piqs/piqs.py on lines 219..221

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    @classmethod
    def StateFeedback(
        cls,
        default: Qobj | _data.Data = None,
        raw_data: bool = False,
Severity: Minor
Found in qutip/solver/mesolve.py and 1 other location - About 30 mins to fix
qutip/solver/sesolve.py on lines 210..241

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 64.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid too many return statements within this function.
Open

        return Qobj(_jz(j, dtype=dtype), dims=dims,
Severity: Major
Found in qutip/core/operators.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return jm
    Severity: Major
    Found in qutip/piqs/piqs.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return True
      Severity: Major
      Found in qutip/piqs/piqs.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return (fidelity(oper_choi, target_choi)/d)**2
        Severity: Major
        Found in qutip/core/metrics.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return sm
          Severity: Major
          Found in qutip/piqs/piqs.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return np.cos(big_angle / 2)
            Severity: Major
            Found in qutip/core/metrics.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return Qobj(_data.add(A, A.adjoint()), dims=dims,
              Severity: Major
              Found in qutip/core/operators.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return jx
                Severity: Major
                Found in qutip/piqs/piqs.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return jz
                  Severity: Major
                  Found in qutip/piqs/piqs.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return process_fidelity(target, oper)  # reverse order
                    Severity: Major
                    Found in qutip/core/metrics.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return left_t @ right_t
                      Severity: Major
                      Found in qutip/core/tensor.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return jp
                        Severity: Major
                        Found in qutip/piqs/piqs.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return self._sum_abs.sum_final_state
                          Severity: Major
                          Found in qutip/solver/multitrajresult.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return sp
                            Severity: Major
                            Found in qutip/piqs/piqs.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return jy
                              Severity: Major
                              Found in qutip/piqs/piqs.py - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language