ihavalyova/DiAtomic

View on GitHub

Showing 129 of 135 total issues

Spectrum has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

class Spectrum:

    def __init__(self, H, dmfs=None, spec_type='absorption'):
        """Calculate the spectral quantities

Severity: Minor
Found in diatomic/spectrum.py - About 3 hrs to fix

    Function _generate_operator_widgets has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def _generate_operator_widgets(self):
    
            global opr_count
            opr_count += 1
            top_margin = 30
    Severity: Major
    Found in diatomic/gui.py - About 2 hrs to fix

      Function _on_solve_button_clicked has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def _on_solve_button_clicked(self):
      
              diatomic = Diatomic(
                  molecule=self.sel_isotopes,
                  refj=self.refj,
      Severity: Minor
      Found in diatomic/gui.py - About 2 hrs 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

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

              rule_ss2 = \
                  (self.state1.spin - self.state2.spin) == 2.0 or \
                  (self.state1.spin - self.state2.spin) == -2.0 and \
                  rule_ss2_2so
      Severity: Major
      Found in diatomic/operator.py and 1 other location - About 2 hrs to fix
      diatomic/operator.py on lines 862..865

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

      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

              rule_ss1 = \
                  (self.state1.spin - self.state2.spin) == 1.0 or \
                  (self.state1.spin - self.state2.spin) == -1.0 and \
                  rule_ss1_1so
      Severity: Major
      Found in diatomic/operator.py and 1 other location - About 2 hrs to fix
      diatomic/operator.py on lines 867..870

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

      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

          def _lambda_doubling_e_parity(self, jjrotn, mass, par):
      
              if par == 1:
                  return self._lambda_doubling(jjrotn, mass, par)
      
      
      Severity: Major
      Found in diatomic/operator.py and 1 other location - About 1 hr to fix
      diatomic/operator.py on lines 652..657

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

      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

          def _lambda_doubling_f_parity(self, jjrotn, mass, par):
      
              if par == 0:
                  return self._lambda_doubling(jjrotn, mass, par)
      
      
      Severity: Major
      Found in diatomic/operator.py and 1 other location - About 1 hr to fix
      diatomic/operator.py on lines 645..650

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

      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 set_data_parameters has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_data_parameters(self, fname):
              """Set the input data parameters
      
              Args:
                  fname (str): The name of the file containing the values
      Severity: Minor
      Found in diatomic/diatomic_data.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 7 locations. Consider refactoring.
      Open

          def _calculate_custom_coupling_on_grid(self, ypar):
      
              xpnts = self.rgrid
              # The parameters in ypar are in au units
              ypnts = ypar[self.sind:self.eind]  # * self.yunits
      Severity: Major
      Found in diatomic/operator.py and 6 other locations - About 1 hr to fix
      diatomic/operator.py on lines 135..140
      diatomic/operator.py on lines 240..245
      diatomic/operator.py on lines 399..404
      diatomic/operator.py on lines 529..534
      diatomic/operator.py on lines 632..637
      diatomic/operator.py on lines 719..724

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

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

          def _calculate_custom_coupling_on_grid(self, ypar):
      
              xpnts = self.rgrid
              # The parameters in ypar are in au units
              ypnts = ypar[self.sind:self.eind]  # * self.yunits
      Severity: Major
      Found in diatomic/operator.py and 6 other locations - About 1 hr to fix
      diatomic/operator.py on lines 135..140
      diatomic/operator.py on lines 240..245
      diatomic/operator.py on lines 399..404
      diatomic/operator.py on lines 529..534
      diatomic/operator.py on lines 719..724
      diatomic/operator.py on lines 826..831

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

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

          def _calculate_custom_coupling_on_grid(self, ypar):
      
              xpnts = self.rgrid
              # The parameters in ypar are in au units
              ypnts = ypar[self.sind:self.eind]  # * self.yunits
      Severity: Major
      Found in diatomic/operator.py and 6 other locations - About 1 hr to fix
      diatomic/operator.py on lines 135..140
      diatomic/operator.py on lines 240..245
      diatomic/operator.py on lines 399..404
      diatomic/operator.py on lines 529..534
      diatomic/operator.py on lines 632..637
      diatomic/operator.py on lines 826..831

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

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

          def _calculate_custom_coupling_on_grid(self, ypar):
      
              xpnts = self.rgrid
              # The parameters in ypar are in au units
              ypnts = ypar[self.sind:self.eind]  # * self.yunits
      Severity: Major
      Found in diatomic/operator.py and 6 other locations - About 1 hr to fix
      diatomic/operator.py on lines 240..245
      diatomic/operator.py on lines 399..404
      diatomic/operator.py on lines 529..534
      diatomic/operator.py on lines 632..637
      diatomic/operator.py on lines 719..724
      diatomic/operator.py on lines 826..831

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

      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

              diag1 = -1.0 / (self.x[2:n] - self.x[1:n-1]) - \
                  (1.0 / (self.x[1:n-1] - self.x[0:n-2]))
      Severity: Major
      Found in diatomic/interpolator.py and 1 other location - About 1 hr to fix
      diatomic/interpolator.py on lines 75..75

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

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

          def _calculate_custom_coupling_on_grid(self, ypar):
      
              xpnts = self.rgrid
              # The parameters in ypar are in au units
              ypnts = ypar[self.sind:self.eind]  # * self.yunits
      Severity: Major
      Found in diatomic/operator.py and 6 other locations - About 1 hr to fix
      diatomic/operator.py on lines 135..140
      diatomic/operator.py on lines 399..404
      diatomic/operator.py on lines 529..534
      diatomic/operator.py on lines 632..637
      diatomic/operator.py on lines 719..724
      diatomic/operator.py on lines 826..831

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

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

          def _calculate_custom_coupling_on_grid(self, ypar):
      
              xpnts = self.rgrid
              # The parameters in ypar are in au units
              ypnts = ypar[self.sind:self.eind]  # * self.yunits
      Severity: Major
      Found in diatomic/operator.py and 6 other locations - About 1 hr to fix
      diatomic/operator.py on lines 135..140
      diatomic/operator.py on lines 240..245
      diatomic/operator.py on lines 529..534
      diatomic/operator.py on lines 632..637
      diatomic/operator.py on lines 719..724
      diatomic/operator.py on lines 826..831

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

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

          def _calculate_custom_coupling_on_grid(self, ypar):
      
              xpnts = self.rgrid
              # The parameters in ypar are in au units
              ypnts = ypar[self.sind:self.eind]  # * self.yunits
      Severity: Major
      Found in diatomic/operator.py and 6 other locations - About 1 hr to fix
      diatomic/operator.py on lines 135..140
      diatomic/operator.py on lines 240..245
      diatomic/operator.py on lines 399..404
      diatomic/operator.py on lines 632..637
      diatomic/operator.py on lines 719..724
      diatomic/operator.py on lines 826..831

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

      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

              diag0 = 1.0 / (self.x[1:n-1] - self.x[0:n-2])
      Severity: Major
      Found in diatomic/interpolator.py and 1 other location - About 1 hr to fix
      diatomic/interpolator.py on lines 78..79

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

      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 __init__ has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, nstate, Js=None, Je=None, Jvalues=None, symmetry=(0,),
      Severity: Major
      Found in diatomic/diatomic_data.py - About 1 hr to fix

        Function __init__ has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(self, objs=None, pair_states=None, label='', model='pointwise',
                         rotc=0.0, multiplier=1, custom_func=None, shift_by=0.0):
        
                diatomic, grid, states = objs[0], objs[1], objs[2]
        
        
        Severity: Minor
        Found in diatomic/operator.py - About 1 hr to fix

          Function _init_state_dynamic_widget_lists has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def _init_state_dynamic_widget_lists(self):
          
                  self.stateGridLayouts = []
                  self.stateLabels = []
                  self.stateJsLabels = []
          Severity: Minor
          Found in diatomic/gui.py - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language