Showing 326 of 326 total issues

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

        elif self.ados.exponents[k].type == BathExponent.types["-"]:
            if sign1 == -1:
                op = _data.mul(self._s_pre_minus_post_Qdag[k], -1j * sign2)
            else:
                op = _data.mul(self._s_pre_plus_post_Qdag[k], -1j * sign2)
Severity: Major
Found in qutip/solver/heom/bofin_solvers.py and 1 other location - About 1 hr to fix
qutip/solver/heom/bofin_solvers.py on lines 817..821

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 75.

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

        if self.ados.exponents[k].type == BathExponent.types["+"]:
            if sign1 == -1:
                op = _data.mul(self._s_pre_minus_post_Q[k], -1j * sign2)
            else:
                op = _data.mul(self._s_pre_plus_post_Q[k], -1j * sign2)
Severity: Major
Found in qutip/solver/heom/bofin_solvers.py and 1 other location - About 1 hr to fix
qutip/solver/heom/bofin_solvers.py on lines 822..826

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 75.

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

Function smesolve has 15 arguments (exceeds 10 allowed). Consider refactoring.
Open

def smesolve(
Severity: Major
Found in qutip/solver/stochastic.py - About 1 hr to fix

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

            if (self.N % 2) == 0:
                cols = int(self.N / 2 + 1)
            else:
                cols = int(self.N / 2 + 1 / 2)
    Severity: Major
    Found in qutip/piqs/piqs.py and 1 other location - About 1 hr to fix
    qutip/piqs/piqs.py on lines 1772..1775

    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 71.

    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 2 locations. Consider refactoring.
    Open

            if (self.N % 2) == 0:
                cols = int(self.N / 2 + 1)
            else:
                cols = int(self.N / 2 + 1 / 2)
    Severity: Major
    Found in qutip/piqs/piqs.py and 1 other location - About 1 hr to fix
    qutip/piqs/piqs.py on lines 1655..1658

    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 71.

    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 2 locations. Consider refactoring.
    Open

        for inds in _index_permutations([len(lbls) for lbls in lbls_list]):
            xlabels.append("".join(
                [lbls_list[k][inds[k]] for k in range(len(lbls_list))]))
    Severity: Major
    Found in qutip/tomography.py and 1 other location - About 1 hr to fix
    qutip/tomography.py on lines 70..72

    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 71.

    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

    Function simdiag has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
    Open

    def simdiag(ops, evals: bool = True, *,
                tol: float = 1e-14, safe_mode: bool = True):
        """Simultaneous diagonalization of commuting Hermitian matrices.
    
        Parameters
    Severity: Minor
    Found in qutip/simdiag.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

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

        for inds in _index_permutations([len(lbls) for lbls in lbls_list]):
            xlabels.append("".join([lbls_list[k][inds[k]]
                                    for k in range(len(lbls_list))]))
    Severity: Major
    Found in qutip/tomography.py and 1 other location - About 1 hr to fix
    qutip/tomography.py on lines 132..134

    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 71.

    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

    Function ssesolve has 14 arguments (exceeds 10 allowed). Consider refactoring.
    Open

    def ssesolve(
    Severity: Major
    Found in qutip/solver/stochastic.py - About 1 hr to fix

      Function tensor has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
      Open

      def tensor(*args):
          """Calculates the tensor product of input operators.
      
          Parameters
          ----------
      Severity: Minor
      Found in qutip/core/tensor.py - About 55 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 _eigs_dense has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
      Open

      def _eigs_dense(data, isherm, vecs, eigvals, num_large, num_small):
          """
          Internal functions for computing eigenvalues and eigenstates for a dense
          matrix.
          """
      Severity: Minor
      Found in qutip/core/data/eigen.py - About 55 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 anim_matrix_histogram has 13 arguments (exceeds 10 allowed). Consider refactoring.
      Open

      def anim_matrix_histogram(Ms, x_basis=None, y_basis=None, limits=None,
      Severity: Major
      Found in qutip/animation.py - About 50 mins to fix

        Function matrix_histogram has 13 arguments (exceeds 10 allowed). Consider refactoring.
        Open

        def matrix_histogram(M, x_basis=None, y_basis=None, limits=None,
        Severity: Major
        Found in qutip/visualization.py - About 50 mins to fix

          Function _generic_pmap has 13 arguments (exceeds 10 allowed). Consider refactoring.
          Open

          def _generic_pmap(task, values, task_args, task_kwargs, reduce_func,
          Severity: Major
          Found in qutip/solver/parallel.py - About 50 mins to fix

            Function mcsolve has 13 arguments (exceeds 10 allowed). Consider refactoring.
            Open

            def mcsolve(
            Severity: Major
            Found in qutip/solver/mcsolve.py - About 50 mins to fix

              Function anim_wigner has 13 arguments (exceeds 10 allowed). Consider refactoring.
              Open

              def anim_wigner(rhos, xvec=None, yvec=None, method='clenshaw', projection='2d',
              Severity: Major
              Found in qutip/animation.py - About 50 mins to fix

                Function plot_wigner has 13 arguments (exceeds 10 allowed). Consider refactoring.
                Open

                def plot_wigner(rho, xvec=None, yvec=None, method='clenshaw', projection='2d',
                Severity: Major
                Found in qutip/visualization.py - About 50 mins to fix

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

                          if len(new_m_ops) != len(self.m_ops):
                              if self.heterodyne:
                                  raise ValueError(
                                      f"2 `m_ops` per `sc_ops`, {len(self.rhs.sc_ops)} operators"
                                      " are expected for heterodyne measurement."
                  Severity: Minor
                  Found in qutip/solver/stochastic.py and 1 other location - About 50 mins to fix
                  qutip/solver/stochastic.py on lines 648..656

                  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 68.

                  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

                          if len(new_dW_factors) != len(self._dW_factors):
                              if self.heterodyne:
                                  raise ValueError(
                                      f"2 `dW_factors` per `sc_ops`, {len(self.rhs.sc_ops)} "
                                      "values are expected for heterodyne measurement."
                  Severity: Minor
                  Found in qutip/solver/stochastic.py and 1 other location - About 50 mins to fix
                  qutip/solver/stochastic.py on lines 616..624

                  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 68.

                  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

                                  ck_R = (
                                      sum(exp.ck for exp in combine if exp.type == exp.types.R) +
                                      sum(exp.ck for exp in combine if exp.type == exp.types.RI)
                  Severity: Minor
                  Found in qutip/solver/heom/bofin_baths.py and 1 other location - About 45 mins to fix
                  qutip/solver/heom/bofin_baths.py on lines 329..331

                  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 67.

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language