capocchi/DEVSimPy

View on GitHub

Showing 1,315 of 1,315 total issues

Function __setstate__ has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
Open

    def __setstate__(self, state):
        """ Restore state from the unpickled state values.
        """

        python_path = state['python_path']
Severity: Minor
Found in Container.py - About 2 days 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 SelectProp has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
Open

    def SelectProp(self, evt):
        """
        """

        row, col, pos= evt.GetRow(), evt.GetCol(), evt.GetPosition()
Severity: Minor
Found in PropertiesGridCtrl.py - About 1 day 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

File Utilities.py has 783 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
# Utilities.py ---
#                    --------------------------------
Severity: Major
Found in Utilities.py - About 1 day to fix

    File DSV.py has 769 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    """
    DSV.py - Cliff Wells, 2002
      Import/export DSV (delimiter separated values, a generalization of CSV).
    
    
    Severity: Major
    Found in DSV.py - About 1 day to fix

      File PropertiesGridCtrl.py has 767 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      
      ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
      # PropertiesGridCtrl.py ---
      #                     --------------------------------
      Severity: Major
      Found in PropertiesGridCtrl.py - About 1 day to fix

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

            def OnUndo(self, event):
                """ Undo the diagram.
                """
                ### get toolbar and clientData defined in AddTool
                toolbar = event.GetEventObject()
        Severity: Major
        Found in devsimpy.py and 1 other location - About 1 day to fix
        devsimpy.py on lines 1326..1353

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

        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 OnRedo(self, event):
                """ Redo the diagram
                """
        
                toolbar = event.GetEventObject()
        Severity: Major
        Found in devsimpy.py and 1 other location - About 1 day to fix
        devsimpy.py on lines 1297..1324

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

        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

        File LibraryTree.py has 760 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        
        ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
        # LibraryTree.py ---
        #                     --------------------------------
        Severity: Major
        Found in LibraryTree.py - About 1 day to fix

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

                      if wx.VERSION_STRING < '2.9':
                          self.tools.append(toolbar.AddTool(ID_DOWNWARD, wx.Bitmap(os.path.join(ICON_PATH,'downward.png')), shortHelpString=_('Downward rules'), longHelpString=_('Define Downward rules atomic model')))
                          self.tools.append(toolbar.AddTool(ID_UPWARD, wx.Bitmap(os.path.join(ICON_PATH,'upward.png')), shortHelpString=_('Upward rules'), longHelpString=_('Define Upward rules atomic model')))
                      else:
                          self.tools.append(toolbar.AddTool(ID_DOWNWARD, "", wx.Bitmap(os.path.join(ICON_PATH,'downward.png')), shortHelp=_('Downward rules')))
          Severity: Major
          Found in DetachedFrame.py and 1 other location - About 1 day to fix
          devsimpy.py on lines 638..643

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

          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 wx.VERSION_STRING < '4.0':
                      self.tools.append(tb.AddTool(ID_DOWNWARD, wx.Bitmap(os.path.join(ICON_PATH,'downward.png')), shortHelpString=_('Downward rules'), longHelpString=_('Define Downward atomic model')))
                      self.tools.append(tb.AddTool(ID_UPWARD, wx.Bitmap(os.path.join(ICON_PATH,'upward.png')), shortHelpString=_('Upward rules'), longHelpString=_('Define Upward atomic model')))
                  else:
                      self.tools.append(tb.AddTool(ID_DOWNWARD, "", wx.Bitmap(os.path.join(ICON_PATH,'downward.png')), shortHelp=_('Downward rules')))
          Severity: Major
          Found in devsimpy.py and 1 other location - About 1 day to fix
          DetachedFrame.py on lines 172..177

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

          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

          MainApplication has 87 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class MainApplication(wx.Frame):
              """ DEVSimPy main application.
              """
          
              def __init__(self, parent, id, title):
          Severity: Major
          Found in devsimpy.py - About 1 day to fix

            Function makeDEVSInstance has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
            Open

                def makeDEVSInstance(diagram = None):
                    """ Return the DEVS instance of diagram. Iterations order is very important!
                            1. we make the codeblock devs instance
                            2. we make the devs port instance for all devsimpy port
                            3. we make Containerblock instance
            Severity: Minor
            Found in Container.py - About 1 day 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 massAtomicTransitions has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
            Open

                def massAtomicTransitions(self, trans, clock):
                    """
                    AtomicDEVS function to perform all necessary transitions, does so on a collection of models for performance.
            
                    :param trans: iterable containing all models and their requested transition
            Severity: Minor
            Found in DEVSKernel/PyPDEVS/pypdevs221/src/solver.py - About 1 day 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 OnMotion has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
            Open

                    def OnMotion(self, event):
                        """ Motion manager.
                        """ 
            
                        ### current cursor
            Severity: Minor
            Found in Container.py - About 1 day 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

            File PluginsGUI.py has 689 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            
            ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
            # PluginGUI.py ---
            #                    --------------------------------
            Severity: Major
            Found in PluginsGUI.py - About 1 day to fix

              Function directConnect has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
              Open

                  def directConnect(self):
                      """
                      Direct connect this kernel's model
                      """
                      if self.directConnected:
              Severity: Minor
              Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 1 day 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

              File Components.py has 670 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              
              ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
              # Components.py ---
              #                    --------------------------------
              Severity: Major
              Found in Components.py - About 1 day to fix

                File DEVS.py has 668 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: Latin-1 -*-
                """
                Classes and tools for DEVS model specification
                """
                
                
                Severity: Major
                Found in DEVSKernel/PyPDEVS/pypdevs221/src/DEVS.py - About 1 day to fix

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

                          for i in range(len(vcdState)):
                              if (i == 0):
                                  if vcdState[i] == 'b':
                                      continue
                                  else:
                  Severity: Major
                  Found in DEVSKernel/PyPDEVS/old/tracers.py and 1 other location - About 1 day to fix
                  DEVSKernel/PyPDEVS/pypdevs221/src/tracerVCD.py on lines 127..137

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

                  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 i in range(len(vcdState)):
                              if (i == 0):
                                  if vcdState[i] == 'b':
                                      continue
                                  else:
                  Severity: Major
                  Found in DEVSKernel/PyPDEVS/pypdevs221/src/tracerVCD.py and 1 other location - About 1 day to fix
                  DEVSKernel/PyPDEVS/old/tracers.py on lines 393..403

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

                  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