ihavalyova/DiAtomic

View on GitHub
diatomic/gui.py

Summary

Maintainability
F
6 days
Test Coverage

File gui.py has 909 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import sys
import numpy as np
from PyQt5 import QtCore, QtGui, QtWidgets
import pyqtgraph as pg

Severity: Major
Found in diatomic/gui.py - About 2 days to fix

    Diatom has 61 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Diatom(QtWidgets.QMainWindow, Ui_MainWindow):
    
        def __init__(self):
    
            super().__init__()
    Severity: Major
    Found in diatomic/gui.py - About 1 day to fix

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

          def __init__(self):
      
              super().__init__()
              Ui_MainWindow.__init__(self)
              self.setupUi(self)
      Severity: Major
      Found in diatomic/gui.py - About 3 hrs to fix

        Function _generate_state_widgets has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function _on_preview_output_button_clicked has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              def _on_preview_output_button_clicked(self):
          
                  if self.calc_eigenenr:
                      try:
                          cal_eignenr = np.genfromtxt(self.file_eigenenr, comments='#', autostrip=True)
          Severity: Minor
          Found in diatomic/gui.py - About 3 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

          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

            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

              Function _on_solve_button_clicked has 36 lines of code (exceeds 25 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 1 hr to fix

                Function _init_operator_dynamic_widget_lists has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def _init_operator_dynamic_widget_lists(self):
                
                        self.operatorGridLayouts = []
                        self.operatorTypeLabels = []
                        self.operatorPairStateLabels = []
                Severity: Minor
                Found in diatomic/gui.py - About 1 hr to fix

                  Function _on_show_radial_parameters_button_clicked has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _on_show_radial_parameters_button_clicked(self, index):
                  
                          # self._toggle_table_widget()
                  
                          params = []
                  Severity: Minor
                  Found in diatomic/gui.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

                  Function _remove_layout has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _remove_layout(self, layout):
                          print(layout)
                          for i in range(len(layout)):
                              print(i, layout[i])
                              temp_layout = layout[i]
                  Severity: Minor
                  Found in diatomic/gui.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 _on_preview_input_params_button_clicked has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _on_preview_input_params_button_clicked(self):
                  
                          self._toggle_table_widget()
                  
                          params = []
                  Severity: Minor
                  Found in diatomic/gui.py - About 25 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 _on_plot_rad_params_push_button_clicked has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _on_plot_rad_params_push_button_clicked(self, index):
                  
                          params = []
                          found = False
                          with open(self.input_params_file, encoding='utf-8') as fstrm:
                  Severity: Minor
                  Found in diatomic/gui.py - About 25 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

                  There are no issues that match your filters.

                  Category
                  Status