capocchi/DEVSimPy

View on GitHub
Container.py

Summary

Maintainability
F
1 mo
Test Coverage

File Container.py has 3274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
# Container.py ---
#                      --------------------------------
Severity: Major
Found in Container.py - About 1 wk to fix

    Function __setstate__ has a Cognitive Complexity of 194 (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 3 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 OnLeftUp has a Cognitive Complexity of 157 (exceeds 5 allowed). Consider refactoring.
    Open

            def OnLeftUp(self, event):
                """
                """
    
                cursor = self.GetCursor()
    Severity: Minor
    Found in Container.py - About 3 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 keyPress has a Cognitive Complexity of 109 (exceeds 5 allowed). Consider refactoring.
    Open

            def keyPress(self, event):
                """
                """
    
                key = event.GetKeyCode()
    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 __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 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 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

    ShapeCanvas has 62 functions (exceeds 20 allowed). Consider refactoring.
    Open

        class ShapeCanvas(wx.ScrolledWindow, Abstractable, Subject):
            """ ShapeCanvas class.
            """
    
            ID = 0
    Severity: Major
    Found in Container.py - About 1 day to fix

      Function OnDisconnect has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

              def OnDisconnect(self, event):
                  """ Disconnect selected ports from connectDialog.
                  """
      
                  label_source, label_target = self.dlgConnection.GetLabelSource(), self.dlgConnection.GetLabelTarget()
      Severity: Minor
      Found in Container.py - About 5 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

      Diagram has 42 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Diagram(Savable, Structurable):
          """ Diagram class.
          """
      
          def __init__(self):
      Severity: Minor
      Found in Container.py - About 5 hrs to fix

        Function MsgBoxError has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def MsgBoxError(event, parent, msg):
            """ Pop-up alert for error in the .py file of a model
            """
        
            ### if importation error
        Severity: Minor
        Found in Container.py - About 4 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 OnSimulation has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            def OnSimulation(self, event):
                """ Method calling the simulationGUI
                """
        
                ### if there are models in diagram
        Severity: Minor
        Found in Container.py - About 4 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 select has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

                def select(self, item=None):
                    """ Select the models in param item
                    """
        
                    if item is None:
        Severity: Minor
        Found in Container.py - About 4 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 update has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def update(self, concret_subject = None):
                """ Update method to respond to notify call.
                """
        
                state = concret_subject.GetState()
        Severity: Minor
        Found in Container.py - About 4 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 ShowQuickAttributeEditor has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

                def ShowQuickAttributeEditor(self, selectedShape:list)->None:
                    """ Show a quick dialog with spin to change the number of imput and output of the block.
                    """
        
                    mainW = self.GetTopLevelParent()
        Severity: Minor
        Found in Container.py - About 4 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 OnLeftDown has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

                def OnLeftDown(self,event):
                    """ Left Down mouse bouton has been invoked in the canvas instance.
                    """
        
                    if self.timer.IsRunning():
        Severity: Minor
        Found in Container.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 OnConnect has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

                def OnConnect(self, event):
                    """ Connect selected ports from connectDialog.
                    """
        
                    # dialog results
        Severity: Minor
        Found in Container.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 OnDelete has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

                def OnDelete(self, event):
                    """ Delete menu has been clicked. Delete all selected shape.
                    """
        
                    if len(self.select()) > 1:
        Severity: Minor
        Found in Container.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 draw has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def draw(self, dc):
                """
                """
        
                # Mac's DC is already the same as a GCDC, and it causes
        Severity: Minor
        Found in Container.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 update has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def update(self, concret_subject = None):
                """ Notify has been invocked
                """
                state = Block.update(self, concret_subject)
        
        
        Severity: Minor
        Found in Container.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 RemoveTempTests has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def RemoveTempTests():
                tempdir = os.path.realpath(gettempdir())
                feat_dir = os.path.join(tempdir, 'features')
                if os.path.exists(feat_dir):
                    for root, dirs, files in os.walk(feat_dir, topdown=False):
        Severity: Minor
        Found in Container.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 OnPaste has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

                def OnPaste(self, event):
                    """ Paste menu has been clicked.
                    """
        
                    D = {}  # correspondance between the new and the paste model
        Severity: Minor
        Found in Container.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

        Consider simplifying this complex logical expression.
        Open

                    if key == 316:  # right
                        move = False
                        step = 1 if controlDown else 10
                        for m in self.getSelectedShapes():
                            m.move(step, 0)
        Severity: Critical
        Found in Container.py - About 2 hrs to fix

          Function makeDEVSGraph has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              def makeDEVSGraph(diagram, D = {}, type = object):
                  """ Make a formated dictionnary to make the graph of the DEVS Network: {'S1': [{'C1': (1, 0)}, {'M': (0, 1)}], port 1 of S1 is connected to the port 0 of C1...
                  """
          
          
          
          Severity: Minor
          Found in Container.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 OnNewModel has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

                  def OnNewModel(self, event):
                      """ New model menu has been pressed. Wizard is instanciate.
                      """
          
                      ### mouse positions
          Severity: Minor
          Found in Container.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__ has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def __init__(self,\
                               parent,\
                                id=wx.NewIdRef(), \
                                pos=wx.DefaultPosition, \
                                size=(-1,-1), \
          Severity: Minor
          Found in Container.py - About 1 hr to fix

            Function DeleteShape has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def DeleteShape(self, shape):
                    """ Method that delete all shape links
                    """
            
                    ### delete all shape connected with connection shape
            Severity: Minor
            Found in Container.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 draw has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def draw(self, dc):
                    """ Drawing line.
                    """
                    Shape.draw(self, dc)
            
            
            Severity: Minor
            Found in Container.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 CheckClass has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            def CheckClass(m):
                """ Check if class is ok and return it.
                """
                if inspect.isclass(m):
                    cls = m
            Severity: Minor
            Found in Container.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 DiagramModified has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    def DiagramModified(self):
                        """ Modification printing in statusbar and modify value manager.
            
                            This method manage the propagation of modification.
                            from window where modifications are performed to DEVSimPy main window.
            Severity: Minor
            Found in Container.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 OnPriority has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def OnPriority(self, parent):
                    """ Method that show the priorityGUI frame in order to define the activation priority of components
                    """
            
                    shapes_list = [s.label for s in self.GetShapeList() if isinstance(s, Block)]
            Severity: Minor
            Found in Container.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

            Consider simplifying this complex logical expression.
            Open

            if builtins.__dict__.get('GUI_FLAG',True):
                #-------------------------------------------------------------------------------
                class ShapeCanvas(wx.ScrolledWindow, Abstractable, Subject):
                    """ ShapeCanvas class.
                    """
            Severity: Critical
            Found in Container.py - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                          if (x1<=x<=x2 and y1<=y<=y2) or ((x1<=x<=x2 and y2<y<y1) or (x2<=x<=x1 and y1<=y<=y2) or (x2<=x<=x1 and y2<=y<=y1)):
                              self.x.insert(i+1, x)
                              self.y.insert(i+1, y)
              
                              #### cassure des locks
              Severity: Critical
              Found in Container.py - About 1 hr to fix

                Function OnConnectTo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                        def OnConnectTo(self, event):
                            """
                            """
                            id = event.GetId()
                            menu = event.GetEventObject()
                Severity: Minor
                Found in Container.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 Undo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                        def Undo(self):
                            """
                            """
                
                            mainW = self.GetTopLevelParent()
                Severity: Minor
                Found in Container.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 GetStat has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def GetStat(self, d):
                        """ Get information about diagram like the numbe rof atomic model or the number of link between models.
                        """
                
                        first_coupled = False
                Severity: Minor
                Found in Container.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 GetTempTests has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def GetTempTests(self, global_env=None):
                        if not global_env: global_env = False
                
                        ### Useful vars definition-----------------------------------------------------------------
                        model_path = os.path.dirname(self.python_path)
                Severity: Minor
                Found in Container.py - About 1 hr to fix

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

                      def AddPoint(self, point = (0,0)):
                          """ Add point under LineShape.
                          """
                          x,y = point
                  
                  
                  Severity: Minor
                  Found in Container.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 OnCheck has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def OnCheck(self, event):
                          """ Check button has been clicked. We check if models which compose the diagram are valide.
                          """
                          ### if there are models in diagram
                          if self.GetCount() != 0:
                  Severity: Minor
                  Found in Container.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 OnDeleteNode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def OnDeleteNode(self, event):
                          """
                          """
                          if isinstance(self.item, ConnectionShape):
                              for x in self.item.x:
                  Severity: Minor
                  Found in Container.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 OnAddConstants has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def OnAddConstants(self, event):
                          """ Method that add constant parameters in order to simplify the modling codeBlock model
                          """
                  
                          obj = event.GetEventObject()
                  Severity: Minor
                  Found in Container.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 Clean has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def Clean(self):
                          """ Clean DEVS instances attached to all block model in the diagram.
                          """
                          if not self.devsModel:
                              return
                  Severity: Minor
                  Found in Container.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 getInterceptedShape has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def getInterceptedShape(self, event, exclude=[]):
                              """ Return the intercepted current shape.
                              """
                              # get coordinate of click in our coordinate system
                              if isinstance(event, wx.MouseEvent):
                  Severity: Minor
                  Found in Container.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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          def __init__(self,\
                  Severity: Major
                  Found in Container.py - About 50 mins to fix

                    Function OnEditLabel has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def OnEditLabel(self, event):
                            """ Function called by the OnRightDown call event function.
                            """
                            ### old label
                            old_label = self.label
                    Severity: Minor
                    Found in Container.py - About 45 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

                    Avoid deeply nested control flow statements.
                    Open

                                                if self.timer.IsRunning():
                                                    self.timer.Stop()
                    
                    
                    Severity: Major
                    Found in Container.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if cursor != wx.StockCursor(wx.CURSOR_ARROW):
                                                  cursor = wx.StockCursor(wx.CURSOR_ARROW)
                                              
                      Severity: Major
                      Found in Container.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if str(python_filename).find('\\'):
                                                    ### wrong basename :
                                                    ### os.path.basename does not work when executed on Unix
                                                    ### with a Windows path
                                                    python_path = python_path.replace('\\','/')
                        Severity: Major
                        Found in Container.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if not arg in args_from_stored_constructor_py:
                                                      sys.stdout.write(_("Warning: %s come is old ('%s' arg is deprecated). We update it...\n"%(state['python_path'],arg)))
                                                      del state['args'][arg]
                                                  else:
                                                      try:
                          Severity: Major
                          Found in Container.py - About 45 mins to fix

                            Function draw has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def draw(self, dc):
                                    """ Draw the block on DC.
                                    """
                                    if self.selected:
                                        ### inform about the nature of the block using icon
                            Severity: Minor
                            Found in Container.py - About 45 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

                            Avoid deeply nested control flow statements.
                            Open

                                                    if cs.input is None:
                                                        if isinstance(shape,Port):
                                                            dlg.SetValue('0')
                                                        else:
                                                            if hasattr(shape, 'output'):
                            Severity: Major
                            Found in Container.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if isinstance(node, ResizeableNode) and cursor != wx.StockCursor(wx.CURSOR_SIZING):
                                                          cursor = wx.StockCursor(wx.CURSOR_SIZING)
                                                      elif isinstance(node, ConnectableNode) and cursor != wx.StockCursor(wx.CURSOR_CROSS):
                                                          cursor = wx.StockCursor(wx.CURSOR_CROSS)
                                              
                              Severity: Major
                              Found in Container.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        for a in [os.path.dirname(p) for p in mainW.exportPathsList+mainW.openFileList]:
                                                            p = os.path.join(a,os.path.basename(python_path))
                                                            if os.path.exists(p):
                                                                path = p
                                                                break
                                Severity: Major
                                Found in Container.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if m.SaveFile(gmwiz.model_path):
                                                              m.last_name_saved = gmwiz.model_path
                                                          else:
                                                              dlg = wx.MessageDialog(self, \
                                                                                  _('Error saving file %s\n')%os.path.basename(gmwiz.model_path), \
                                  Severity: Major
                                  Found in Container.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                                if self.selectionStart != point:
                                                                    self.permRect = wx.Rect(self.selectionStart, point)
                                                            
                                    Severity: Major
                                    Found in Container.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if hasattr(mainW,'exportPathsList') and hasattr(mainW,'openFileList'):
                                                                  for p in mainW.exportPathsList+mainW.openFileList:
                                                                      lib_name = os.path.basename(p)
                                                                      if lib_name !='' and lib_name in path:
                                                                          path = p+path.split(lib_name)[-1]
                                      Severity: Major
                                      Found in Container.py - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                                    for s in self.diagram.GetShapeList():
                                                                        x,y = self.getScalledCoordinates(s.x[0],s.y[0])
                                                                        w = (s.x[1]-s.x[0])*self.scalex
                                                                        h = (s.y[1]-s.y[0])*self.scaley
                                                                        
                                        Severity: Major
                                        Found in Container.py - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                                  if prop in self.args:
                                                                      ### is abs fileName ?
                                                                      if os.path.isabs(val):
                                                                          ### if there is an extention, then if the field path exist we color in red and update the bad_filename_path_flag
                                                                          bad_flag_dico.update({prop:not os.path.exists(val) and os.path.splitext(val)[-1] == ''})
                                          Severity: Major
                                          Found in Container.py - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                    if not state['python_path'].endswith('.py'):
                                                                        ### Is this up-to-date???
                                                                        ### we find the python file using re module
                                                                        ### because path can comes from windows and then sep is not the same and os.path.basename don't work !
                                                                        state['python_path'] = os.path.join(path, re.findall("([\w]*[%s])*([\w]*.py)"%os.sep, python_path)[0][-1])
                                            Severity: Major
                                            Found in Container.py - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                      for p in mainW.exportPathsList:
                                                                          lib_name = os.path.basename(p)
                                                                          if lib_name in path:
                                                                              path = p+path.split(lib_name)[-1]
                                                                      
                                              Severity: Major
                                              Found in Container.py - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                        if builtins.__dict__.get('GUI_FLAG',True):
                                                                            import wx
                                                                            mainW = wx.GetApp().GetTopWindow()
                                                                            if hasattr(mainW,'exportPathsList') and hasattr(mainW,'openFileList'):
                                                                                for a in [os.path.dirname(p) for p in mainW.exportPathsList+mainW.openFileList]:
                                                Severity: Major
                                                Found in Container.py - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                          for p in mainW.exportPathsList:
                                                                              lib_name = os.path.basename(p)
                                                                              if lib_name in path:
                                                                                  path = p+path.split(lib_name)[-1]
                                                                          
                                                  Severity: Major
                                                  Found in Container.py - About 45 mins to fix

                                                    Function HitTest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                        def HitTest(self, x, y):
                                                            """
                                                            """
                                                    
                                                            if x < min(self.x)-3:return False
                                                    Severity: Minor
                                                    Found in Container.py - About 45 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

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                            if old_label in diagram.priority_list:
                                                                                ### find index of label priority list and replace it
                                                                                i = diagram.priority_list.index(old_label)
                                                                                diagram.priority_list[i] = new_label
                                                    
                                                    
                                                    Severity: Major
                                                    Found in Container.py - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                              if dir in python_path.split(os.sep)[0:-1]:
                                                                                  ### yes, the python_path is wrong but we find that in the Domain there is a directory with the same name
                                                                                  a = python_path.split(dir+os.sep)
                                                                                  path = os.path.join(DOMAIN_PATH,dir,a[-1])
                                                                                  break
                                                      Severity: Major
                                                      Found in Container.py - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                                                if L:
                                                                                    for arg in L:
                                                                                        if not arg in args_from_stored_constructor_py:
                                                                                            sys.stdout.write(_("Warning: %s come is old ('%s' arg is deprecated). We update it...\n"%(state['python_path'],arg)))
                                                                                            del state['args'][arg]
                                                        Severity: Major
                                                        Found in Container.py - About 45 mins to fix

                                                          Avoid deeply nested control flow statements.
                                                          Open

                                                                                  if isinstance(s, ResizeableNode) and cursor != wx.StockCursor(wx.CURSOR_SIZING):
                                                                                      cursor = wx.StockCursor(wx.CURSOR_SIZING)
                                                          
                                                                                  ### change cursor when connectionShape hit a node
                                                                                  elif isinstance(s, ConnectionShape):
                                                          Severity: Major
                                                          Found in Container.py - About 45 mins to fix

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                                    if not state['python_path'].endswith('.py'):
                                                                                        ### Is this up-to-date???
                                                                                        ### we find the python file using re module
                                                                                        ### because path can comes from windows and then sep is not the same and os.path.basename don't work !
                                                                                        state['python_path'] = os.path.join(path, re.findall("([\w]*[%s])*([\w]*.py)"%os.sep, python_path)[0][-1])
                                                            Severity: Major
                                                            Found in Container.py - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                                      if remove:
                                                                                          self.diagram.DeleteShape(cs)
                                                                                          self.deselect()
                                                                                  else:
                                                              Severity: Major
                                                              Found in Container.py - About 45 mins to fix

                                                                Avoid deeply nested control flow statements.
                                                                Open

                                                                                        if str(python_filename).find('\\'):
                                                                                            ### wrong basename :
                                                                                            ### os.path.basename does not work when executed on Unix
                                                                                            ### with a Windows path
                                                                                            python_path = python_path.replace('\\','/')
                                                                Severity: Major
                                                                Found in Container.py - About 45 mins to fix

                                                                  Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                  Open

                                                                      def __init__(self, x1, y1, x2, y2, label = 'Port'):
                                                                  Severity: Minor
                                                                  Found in Container.py - About 35 mins to fix

                                                                    Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                    Open

                                                                        def __init__(self,x=20, y=20, x2=120, y2=120, r=30.0):
                                                                    Severity: Minor
                                                                    Found in Container.py - About 35 mins to fix

                                                                      Function DoDrawing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                              def DoDrawing(self, dc):
                                                                                  """
                                                                                  """
                                                                      
                                                                                  dc.SetUserScale(self.scalex, self.scaley)
                                                                      Severity: Minor
                                                                      Found in Container.py - About 35 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 OnLeftDown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          def OnLeftDown(self, event):
                                                                              """ On Left Click has been done.
                                                                              """ 
                                                                              mouse_x, mouse_y = event.GetX(), event.GetY()
                                                                      
                                                                      
                                                                      Severity: Minor
                                                                      Found in Container.py - About 35 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 OnLeftDown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          def OnLeftDown(self, event):
                                                                              """ On Left Click has been done.
                                                                              """ 
                                                                              mouse_x, mouse_y = event.GetX(), event.GetY()
                                                                      
                                                                      
                                                                      Severity: Minor
                                                                      Found in Container.py - About 35 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 __setstate__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          def __setstate__(self, state):
                                                                              """ Restore state from the unpickled state values.
                                                                              """
                                                                      
                                                                              ####################################" Just for old model
                                                                      Severity: Minor
                                                                      Found in Container.py - About 35 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 move has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          def move(self, x, y):
                                                                              """ Moving method.
                                                                              """
                                                                      
                                                                              lines_shape = self.item
                                                                      Severity: Minor
                                                                      Found in Container.py - About 35 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

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                              return False if dist > 7 else True
                                                                      Severity: Major
                                                                      Found in Container.py - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                return True
                                                                        Severity: Major
                                                                        Found in Container.py - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                  return True
                                                                          Severity: Major
                                                                          Found in Container.py - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                                return True
                                                                            Severity: Major
                                                                            Found in Container.py - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                      return diagram.getDEVSModel()
                                                                              Severity: Major
                                                                              Found in Container.py - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                        return True
                                                                                Severity: Major
                                                                                Found in Container.py - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                          return False
                                                                                  Severity: Major
                                                                                  Found in Container.py - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                                    return True
                                                                                    Severity: Major
                                                                                    Found in Container.py - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                                  return False
                                                                                      Severity: Major
                                                                                      Found in Container.py - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                return True
                                                                                        Severity: Major
                                                                                        Found in Container.py - About 30 mins to fix

                                                                                          Function showInputs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                          Open

                                                                                                  def showInputs(self,item=None):
                                                                                                      """ Populate nodes list with output ports.
                                                                                                      """
                                                                                                      if item:
                                                                                                          self.nodes.extend([INode(item, n, self,  item.getInputLabel(n)) for n in range(item.input)])
                                                                                          Severity: Minor
                                                                                          Found in Container.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 GetTempTests has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                          Open

                                                                                              def GetTempTests(self, global_env=None):
                                                                                                  if not global_env: global_env = False
                                                                                          
                                                                                                  ### Useful vars definition-----------------------------------------------------------------
                                                                                                  model_path = os.path.dirname(self.python_path)
                                                                                          Severity: Minor
                                                                                          Found in Container.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 __getattr__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                          Open

                                                                                              def __getattr__(self, name):
                                                                                                  """Called when an attribute lookup has not found the attribute in the usual places.
                                                                                                  """
                                                                                          
                                                                                                  if name == 'dump_attributes':
                                                                                          Severity: Minor
                                                                                          Found in Container.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 draw has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                          Open

                                                                                              def draw(self, dc):
                                                                                                  """ Drawing method.
                                                                                                  """
                                                                                          
                                                                                                  x,y = self.item.getPortXY('input', self.index)
                                                                                          Severity: Minor
                                                                                          Found in Container.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 lock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                          Open

                                                                                              def lock(self):
                                                                                                  """
                                                                                                  """
                                                                                          
                                                                                                  if self.input and self.output:
                                                                                          Severity: Minor
                                                                                          Found in Container.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 showOutputs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                          Open

                                                                                                  def showOutputs(self, item=None):
                                                                                                      """ Populate nodes list with output ports.
                                                                                                      """
                                                                                                      if item:
                                                                                                          self.nodes.extend([ONode(item, n, self, item.getInputLabel(n)) for n in range(item.output)])
                                                                                          Severity: Minor
                                                                                          Found in Container.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 deselect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                          Open

                                                                                                  def deselect(self, item=None):
                                                                                                      """ Deselect all shapes
                                                                                                      """
                                                                                          
                                                                                                      if item is None:
                                                                                          Severity: Minor
                                                                                          Found in Container.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 __getattr__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                          Open

                                                                                              def __getattr__(self, name):
                                                                                                  """Called when an attribute lookup has not found the attribute in the usual places
                                                                                                  """
                                                                                          
                                                                                                  if name == 'dump_attributes':
                                                                                          Severity: Minor
                                                                                          Found in Container.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 draw has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                          Open

                                                                                              def draw(self, dc):
                                                                                                  """ Drawing method.
                                                                                                  """
                                                                                                  x,y = self.item.getPortXY('output', self.index)
                                                                                                  self.moveto(x, y)
                                                                                          Severity: Minor
                                                                                          Found in Container.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 OnExport has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                          Open

                                                                                              def OnExport(self, event):
                                                                                                  """ Method that export Block.
                                                                                                      OnExport is invoked from Menu.py file and the id of sub_menu allows the selection of the appropriate save method in SaveFile (implemented in Savable.py)
                                                                                                  """
                                                                                          
                                                                                          
                                                                                          Severity: Minor
                                                                                          Found in Container.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