capocchi/DEVSimPy

View on GitHub
DEVSKernel/PyPDEVS/old/basesimulator.py

Summary

Maintainability
F
2 wks
Test Coverage

File basesimulator.py has 1282 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: Latin-1 -*-
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
# basesimulator.py --- 'Plain' DEVS Model Simulator
#                     --------------------------------
#                            Copyright (c) 2013
Severity: Major
Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 3 days to fix

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

        def directConnect(self):
            """
            Direct connect this kernel's model
            """
            if self.directConnected:
    Severity: Minor
    Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    BaseSimulator has 67 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BaseSimulator(Solver):
        """
        The BaseSimulator class, this is the core of the complete simulation and
        is exported with Pyro as the representation of a server.
        """
    Severity: Major
    Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 1 day to fix

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

          def getTargets(self, modelname, portname):
              #TODO multiple remotes are UNTESTED!
              # We can assume that this model was already direct connected
              #print("Fetching targets for " + modelname + " ==> " + portname)
              port = None
      Severity: Minor
      Found in DEVSKernel/PyPDEVS/old/basesimulator.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 check has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def check(self, clocktime = -1):
              """
              Checks wheter or not simulation should still continue. This will either
              call the global time termination check, or the local state termination
              check, depending on configuration.
      Severity: Minor
      Found in DEVSKernel/PyPDEVS/old/basesimulator.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 runsim has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def runsim(self):
              """
              Run the simulation until the termination condition signals the
              end of the simulation. Keeps processing until there are no more
              dirty queue's, so doesn't stop immediately after fulfulling the
      Severity: Minor
      Found in DEVSKernel/PyPDEVS/old/basesimulator.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 setGlobals has 16 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def setGlobals(self, address, loglevel, verbose, xml, vcd, controller, seed, checkpointfrequency, gvtfrequency, statesaver, kernels, manualCopy, allowNested, disallowIrreversible, realtime, inputReferences):
      Severity: Major
      Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 2 hrs to fix

        Function receiveControl has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def receiveControl(self, msg):
                """
                Process an incomming control message for GVT calculation.
                Args:
                    msg - the control message
        Severity: Minor
        Found in DEVSKernel/PyPDEVS/old/basesimulator.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 inits has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def inits(self):
                """
                Initialise the simulation kernel, this is split up from the constructor to
                make it possible to reset the kernel without reconstructing the kernel.
                """
        Severity: Minor
        Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 1 hr to fix

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

              def simulate(self):
                  """
                  Start up simulation on this kernel
                  """
                  thrd = threading.Thread(target=BaseSimulator.externalQueueProcessor, args=[self])
          Severity: Minor
          Found in DEVSKernel/PyPDEVS/old/basesimulator.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 findModel has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def findModel(self, name):
                  # Will be only 1 step in each basesimulator due to direct connection
                  bestmatch = ""
                  foundmodel = None
                  assert debug("Finding model")
          Severity: Minor
          Found in DEVSKernel/PyPDEVS/old/basesimulator.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 simulatorProcessEvent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def simulatorProcessEvent(self, eventPort="", eventValue="", eventTime=0):
                  # For real time
                  if (not self.check()):
                      if eventPort == "" and eventValue == "":
                          clock = self.getTimeNext()
          Severity: Minor
          Found in DEVSKernel/PyPDEVS/old/basesimulator.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 self.termination_server and cnt and not self.finish_sent:
                          # Local conditions _currently_ state that simulation can finish
                          # due to timewarp, we aren't sure if this is actually the case,
                          # so wait until GVT has arrived to make a certain guess
                          getProxy(self.controller_name).finishAtTime(clocktime)
          Severity: Critical
          Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 1 hr to fix

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

                def finishRing(self, count):
                    """
                    Go over the ring and ask each kernel whether it is OK to stop simulation
                    or not. Uses a count to check that no messages are yet to be processed.
                    Args:
            Severity: Minor
            Found in DEVSKernel/PyPDEVS/old/basesimulator.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 findMessage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def findMessage(self, clock):
                    """
                    Search for the first message that must be sent next
                    Args:
                        clock - current simulation time
            Severity: Minor
            Found in DEVSKernel/PyPDEVS/old/basesimulator.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 performActions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def performActions(self, gvt = float('inf')):
                    """
                    Perform all irreversible actions up to the provided time.
                    If time is not specified, all queued actions will be executed (in case simulation is finished)
                    Args:
            Severity: Minor
            Found in DEVSKernel/PyPDEVS/old/basesimulator.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 revert has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def revert(self, time):
                    """
                    Revert the current simulation kernel to the specified time. All messages
                    sent after this time will be invalidated, all states produced after this
                    time will be removed.
            Severity: Minor
            Found in DEVSKernel/PyPDEVS/old/basesimulator.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 returnTargets has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def returnTargets(self, port):
                    targets = []
                    #print("Searching targets for port with outline: " + str(port.outLine))
                    for outport in port.outLine:
                        #print("Checking port " + str(outport.getPortFullName()))
            Severity: Minor
            Found in DEVSKernel/PyPDEVS/old/basesimulator.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

            Avoid deeply nested control flow statements.
            Open

                                    if j.hostDEVS == self:
                                        depend = True
                            if depend:
            Severity: Major
            Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for target in targets:
                                          current = remapped.get(target[0], [])
                                          current.append([target[1], target[2]])
                                          remapped[target[0]] = current
                                      for entry in list(remapped.items()):
              Severity: Major
              Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for entry in list(remapped.items()):
                                            location = entry[0]
                                            connected = entry[1]
                                            rcdevs = RemoteCDEVS(location, connected)
                                            self.model.componentSet.append(rcdevs)
                Severity: Major
                Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 45 mins to fix

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

                      def getVCDVariables(self):
                          """
                          Generate a list of all variables that exist in the current scope
                          Returns:
                              list - all VCD variables in current scope
                  Severity: Minor
                  Found in DEVSKernel/PyPDEVS/old/basesimulator.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 __getstate__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __getstate__(self):
                          """
                          Fetch a pickle-compliant representation of the model
                          """
                          retdict = {}
                  Severity: Minor
                  Found in DEVSKernel/PyPDEVS/old/basesimulator.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 presentstate
                  Severity: Major
                  Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return copy(savedstate)
                    Severity: Major
                    Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return savedstate
                      Severity: Major
                      Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return copy(presentstate)
                        Severity: Major
                        Found in DEVSKernel/PyPDEVS/old/basesimulator.py - About 30 mins to fix

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

                              def getInOut(self, name):
                                  assert debug("GetInOut called")
                                  if isinstance(name, list):
                                      ports = [self.getModelByName(connection[0]).getPortByName(connection[1]) for connection in name]
                                      nport = Port(name="proxy-" + str(len(self.model.remapPort2Num)), isInput=True)
                          Severity: Minor
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.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 externalInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def externalInput(self, msg):
                                  """
                                  Processes an external input message, this should NOT be called manually as
                                  it will immediately process the message before all other messages that are
                                  passed 'the right way'.
                          Severity: Minor
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.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 loadstate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def loadstate(self, savedstate):
                                  if self.state_saving == 5:
                                      return savedstate.copy()
                                  elif self.state_saving == 2:
                                      return pickle.loads(savedstate)
                          Severity: Minor
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.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 savestate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def savestate(self, presentstate):
                                  # Put the most frequently used on top
                                  if self.state_saving == 5:
                                      return presentstate.copy()
                                  elif self.state_saving == 2:
                          Severity: Minor
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.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 send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def send(self, model_id, msg, external = False):
                                  """
                                  Send a message to a specific model
                                  Args:
                                      model_id - identifier of the model, can be either an ID or None (denotes root model at this simulator)
                          Severity: Minor
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.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

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

                                      for outport in comp.OPorts:
                                          newline = []
                                          for outline in outport.outLine:
                                              if isinstance(outline.hostDEVS, CoupledDEVS) and outline.hostDEVS != self.model:
                                                  outport.outLine.extend(outline.outLine)
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 5 hrs to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 1336..1343

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 87.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                      for inport in comp.IPorts:
                                          newline = []
                                          for inline in inport.inLine:
                                              if isinstance(inline.hostDEVS, CoupledDEVS) and inline.hostDEVS != self.model:
                                                  inport.inLine.extend(inline.inLine)
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 5 hrs to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 1328..1335

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 87.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                  if gvt != float('inf'):
                                      # Only take the relevant part to sort, this will decrease complexity
                                      lst = []
                                      remainder = []
                                      for i in self.actions:
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 5 hrs to fix
                          DEVSKernel/PyPDEVS/pypdevs221/src/basesimulator.py on lines 878..889

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 86.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                              for target in targets:
                                                  current = remapped.get(target[0], [])
                                                  current.append([target[1], target[2]])
                                                  remapped[target[0]] = current
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 3 hrs to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 1392..1395

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 65.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                                  for target in targets:
                                                      current = remapped.get(target[0], [])
                                                      current.append([target[1], target[2]])
                                                      remapped[target[0]] = current
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 3 hrs to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 1367..1370

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 65.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                  if GVT < self.GVT:
                                      raise DEVSException("GVT cannot decrease from " + str(self.GVT) + " to " + str(GVT) + "!")
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 2 hrs to fix
                          DEVSKernel/PyPDEVS/pypdevs221/src/basesimulator.py on lines 506..507

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 53.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                  assert debug("Sending message with color: " + str(color) + " at time " + str(timestamp) + " to " + str(destination))
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 1 hr to fix
                          DEVSKernel/PyPDEVS/old/server.py on lines 130..130

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 49.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                      newtime = min(self.model.timeNext[0], self.model.timeLast[0], self.prevtime[0])
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 1 hr to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 454..454

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 39.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                      newtime = min(self.model.timeNext[0], self.model.timeLast[0], self.prevtime[0])
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 1 hr to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 429..429

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 39.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                  if self.checkpointCounter == self.checkpointFreq:
                                      self.checkpoint()
                                      self.checkpointCounter = 0
                                  else:
                                      self.checkpointCounter += 1
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 1 hr to fix
                          DEVSKernel/PyPDEVS/pypdevs221/src/basesimulator.py on lines 574..578

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 38.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                      elif (str(i) not in ["sentAlready", "tracers", "inputScheduler", "inqueue", "actions", "transitioning", "modelname_cache"]) and (not str(i).startswith("__")):
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 1 hr to fix
                          DEVSKernel/PyPDEVS/pypdevs221/src/basesimulator.py on lines 106..106

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 38.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                  assert debug("Adding action for time " + str(time) + ", GVT = " + str(self.GVT))
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 2 other locations - About 45 mins to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 402..402
                          DEVSKernel/PyPDEVS/old/solver.py on lines 256..256

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 35.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                  elif self.state_saving == 1:
                                      return pickle.loads(savedstate)
                                  elif self.state_saving == 3:
                                      return copy(savedstate)
                                  elif self.state_saving == 4:
                          Severity: Minor
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 45 mins to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 1178..1183

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 35.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                  elif self.state_saving == 1:
                                      return pickle.dumps(presentstate, 0)
                                  elif self.state_saving == 3:
                                      return copy(presentstate)
                                  elif self.state_saving == 4:
                          Severity: Minor
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 45 mins to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 1163..1168

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 35.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                  assert debug("Got control message: " + str(msg) + " at " + str(self.name))
                          Severity: Major
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 2 other locations - About 45 mins to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 789..789
                          DEVSKernel/PyPDEVS/old/solver.py on lines 256..256

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 35.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                      if self.check(clock[0]) or clock[0] == float('inf'):
                          Severity: Minor
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 40 mins to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 1084..1084

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 34.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                      if self.check(clock[0]) or clock[0] == float('inf'):
                          Severity: Minor
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 40 mins to fix
                          DEVSKernel/PyPDEVS/old/basesimulator.py on lines 1029..1029

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 34.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                  lst.sort(key=lambda i: [i[0], i[2]])
                          Severity: Minor
                          Found in DEVSKernel/PyPDEVS/old/basesimulator.py and 1 other location - About 30 mins to fix
                          DEVSKernel/PyPDEVS/pypdevs221/src/basesimulator.py on lines 894..894

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 32.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          There are no issues that match your filters.

                          Category
                          Status