qutip/piqs/piqs.py

Summary

Maintainability
D
1 day
Test Coverage

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 jm
    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 sp
        Severity: Major
        Found in qutip/piqs/piqs.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 jy
            Severity: Major
            Found in qutip/piqs/piqs.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 True
                Severity: Major
                Found in qutip/piqs/piqs.py - About 30 mins to fix

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

                      if not op:
                          return spin_operators
                      elif op == "x":
                          return sx
                      elif op == "y":
                  Severity: Major
                  Found in qutip/piqs/piqs.py and 1 other location - About 2 hrs to fix
                  qutip/piqs/piqs.py on lines 842..855

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

                  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 not op:
                          return collective_operators
                      elif op == "x":
                          return jx
                      elif op == "y":
                  Severity: Major
                  Found in qutip/piqs/piqs.py and 1 other location - About 2 hrs to fix
                  qutip/piqs/piqs.py on lines 789..802

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

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

                  Do not assign a lambda expression, use a def
                  Open

                          rhs_generate = lambda y, tt, M: M.dot(y)
                  Severity: Minor
                  Found in qutip/piqs/piqs.py by pep8

                  Compound statements (on the same line) are generally discouraged.

                  While sometimes it's okay to put an if/for/while with a small body
                  on the same line, never do this for multi-clause statements.
                  Also avoid folding such long lines!
                  
                  Always use a def statement instead of an assignment statement that
                  binds a lambda expression directly to a name.
                  
                  Okay: if foo == 'blah':\n    do_blah_thing()
                  Okay: do_one()
                  Okay: do_two()
                  Okay: do_three()
                  
                  E701: if foo == 'blah': do_blah_thing()
                  E701: for x in lst: total += x
                  E701: while t < 10: t = delay()
                  E701: if foo == 'blah': do_blah_thing()
                  E701: else: do_non_blah_thing()
                  E701: try: something()
                  E701: finally: cleanup()
                  E701: if foo == 'blah': one(); two(); three()
                  E702: do_one(); do_two(); do_three()
                  E703: do_four();  # useless semicolon
                  E704: def f(x): return 2*x
                  E731: f = lambda x: 2*x

                  Comparison to false should be 'if cond is false:' or 'if not cond:'
                  Open

                          if isdiagonal(initial_state) == False:
                  Severity: Minor
                  Found in qutip/piqs/piqs.py by pep8

                  Comparison to singletons should use "is" or "is not".

                  Comparisons to singletons like None should always be done
                  with "is" or "is not", never the equality operators.
                  
                  Okay: if arg is not None:
                  E711: if arg != None:
                  E711: if None == arg:
                  E712: if arg == True:
                  E712: if False == arg:
                  
                  Also, beware of writing if x when you really mean if x is not None
                  -- e.g. when testing whether a variable or argument that defaults to
                  None was set to some other value.  The other value might have a type
                  (such as a container) that could be false in a boolean context!

                  Do not assign a lambda expression, use a def
                  Open

                      f = lambda x: x * x
                  Severity: Minor
                  Found in qutip/piqs/piqs.py by pep8

                  Compound statements (on the same line) are generally discouraged.

                  While sometimes it's okay to put an if/for/while with a small body
                  on the same line, never do this for multi-clause statements.
                  Also avoid folding such long lines!
                  
                  Always use a def statement instead of an assignment statement that
                  binds a lambda expression directly to a name.
                  
                  Okay: if foo == 'blah':\n    do_blah_thing()
                  Okay: do_one()
                  Okay: do_two()
                  Okay: do_three()
                  
                  E701: if foo == 'blah': do_blah_thing()
                  E701: for x in lst: total += x
                  E701: while t < 10: t = delay()
                  E701: if foo == 'blah': do_blah_thing()
                  E701: else: do_non_blah_thing()
                  E701: try: something()
                  E701: finally: cleanup()
                  E701: if foo == 'blah': one(); two(); three()
                  E702: do_one(); do_two(); do_three()
                  E703: do_four();  # useless semicolon
                  E704: def f(x): return 2*x
                  E731: f = lambda x: 2*x

                  Comparison to false should be 'if cond is false:' or 'if not cond:'
                  Open

                          if self.hamiltonian and isdiagonal(self.hamiltonian) == False:
                  Severity: Minor
                  Found in qutip/piqs/piqs.py by pep8

                  Comparison to singletons should use "is" or "is not".

                  Comparisons to singletons like None should always be done
                  with "is" or "is not", never the equality operators.
                  
                  Okay: if arg is not None:
                  E711: if arg != None:
                  E711: if None == arg:
                  E712: if arg == True:
                  E712: if False == arg:
                  
                  Also, beware of writing if x when you really mean if x is not None
                  -- e.g. when testing whether a variable or argument that defaults to
                  None was set to some other value.  The other value might have a type
                  (such as a container) that could be false in a boolean context!

                  There are no issues that match your filters.

                  Category
                  Status