capocchi/DEVSimPy

View on GitHub

Showing 1,315 of 1,315 total issues

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

Severity: Major
Found in DEVSKernel/PyPDEVS/pypdevs221/examples/trafficLightModel.py and 1 other location - About 1 wk to fix
DEVSKernel/PyPDEVS/old/examples/trafficLightModel.py on lines 0..318

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

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

Severity: Major
Found in DEVSKernel/PyPDEVS/old/examples/trafficLightModel.py and 1 other location - About 1 wk to fix
DEVSKernel/PyPDEVS/pypdevs221/examples/trafficLightModel.py on lines 0..318

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

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

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

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

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

Refactorings

Further Reading

File 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

    File Editor.py has 1899 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    
    ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
    # Editor.py ---
    #                     --------------------------------
    Severity: Major
    Found in Editor.py - About 5 days to fix

      Function getDiagramFromXMLSES has a Cognitive Complexity of 233 (exceeds 5 allowed). Consider refactoring.
      Open

      def getDiagramFromXMLSES(xmlses_file="", canvas=None):
          """
          """
      
          def GetParent(node):
      Severity: Minor
      Found in XMLModule.py - About 4 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

      File devsimpy.py has 1692 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      
      ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
      # devsimpy.py --- DEVSimPy - The Python DEVS GUI modeling and simulation software
      Severity: Major
      Found in devsimpy.py - About 4 days 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

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

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

                      elif re.match('[a-zA-Z0-9_ ]*[a|A]tomi[c|que][a-zA-Z0-9_ ]*',name, re.IGNORECASE):
                          attr = s.getElementsByTagName('mxGeometry')[0].attributes
                          temp = tempfile.NamedTemporaryFile(suffix='.py')
                          temp.write(WizardGUI.atomicCode('AtomicModel'))
                          temp.seek(0)
          Severity: Major
          Found in XMLModule.py and 2 other locations - About 2 days to fix
          XMLModule.py on lines 167..190
          XMLModule.py on lines 219..242

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

          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

                      if s.attributes['vertex'].value == '1' or re.match('[a-zA-Z0-9_ ]*[a|A]tomi[c|que][a-zA-Z0-9_ ]*',name, re.IGNORECASE):
                          attr = s.getElementsByTagName('mxGeometry')[0].attributes
                          temp = tempfile.NamedTemporaryFile(suffix='.py')
                          temp.write(WizardGUI.atomicCode('AtomicModel'))
                          temp.seek(0)
          Severity: Major
          Found in XMLModule.py and 2 other locations - About 2 days to fix
          XMLModule.py on lines 167..190
          XMLModule.py on lines 192..216

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

          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

                      if s.attributes['style'].value == 'swimlane' or re.match('[a-zA-Z0-9_ ]*[c|C]oupl[ed|e|é][a-zA-Z0-9_ ]*',name, re.IGNORECASE):
                          attr = s.getElementsByTagName('mxGeometry')[0].attributes
                          temp = tempfile.NamedTemporaryFile(suffix='.py')
                          temp.write(WizardGUI.coupledCode('CoupledModel'))
                          temp.seek(0)
          Severity: Major
          Found in XMLModule.py and 2 other locations - About 2 days to fix
          XMLModule.py on lines 192..216
          XMLModule.py on lines 219..242

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

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

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

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

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

          Refactorings

          Further Reading

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

          # -*- coding: Latin-1 -*-
          """
          Actual simulation kernel
          """
          from .solver import Solver
          Severity: Major
          Found in DEVSKernel/PyPDEVS/pypdevs221/src/basesimulator.py - About 2 days to fix

            File PlotGUI.py has 978 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            
            ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
            # PlotGUI.py --- Plotting class
            #                     --------------------------------
            Severity: Major
            Found in PlotGUI.py - About 2 days to fix

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

                      for module in modelList:
                          self.vcd_file.write(("$scope " + str(module) + " " + str(module) + " $end\n").encode())
                          for var in range(len(self.vcd_varList)):
                              if self.vcd_varList[var].modelName == module:
                                  self.vcd_file.write("$var wire ".encode())
              Severity: Major
              Found in DEVSKernel/PyPDEVS/old/tracers.py and 1 other location - About 2 days to fix
              DEVSKernel/PyPDEVS/pypdevs221/src/tracerVCD.py on lines 92..102

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

              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 module in modelList:
                          self.vcd_file.write(("$scope " + str(module) + " " + str(module) + " $end\n").encode())
                          for var in range(len(self.vcd_varList)):
                              if self.vcd_varList[var].modelName == module:
                                  self.vcd_file.write("$var wire ".encode())
              Severity: Major
              Found in DEVSKernel/PyPDEVS/pypdevs221/src/tracerVCD.py and 1 other location - About 2 days to fix
              DEVSKernel/PyPDEVS/old/tracers.py on lines 508..518

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

              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 c in connectionlist:
                          if name == c.attributes['sinkname'].value:
                              p = u''.join([i for i in c.attributes['sinkport'].value if i.isdigit()])
                              if p ==u'': p=u'1'
                              if HasChild(node):
              Severity: Major
              Found in XMLModule.py and 1 other location - About 2 days to fix
              XMLModule.py on lines 397..415

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

              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 c in connectionlist:
                              if uid == c.attributes['sinkuid'].value:
                                  p = u''.join([i for i in c.attributes['sinkport'].value if i.isdigit()])
                                  if p ==u'': p=u'1'
                                  if HasChild(node):
              Severity: Major
              Found in XMLModule.py and 1 other location - About 2 days to fix
              XMLModule.py on lines 374..392

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

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

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

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

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

              Refactorings

              Further Reading

              Function 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

              File Menu.py has 862 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              
              ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
              # Menu.py ---
              #                    --------------------------------
              Severity: Major
              Found in Menu.py - About 2 days to fix
                Severity
                Category
                Status
                Source
                Language