capocchi/DEVSimPy

View on GitHub

Showing 1,315 of 1,315 total issues

File PreferencesGUI.py has 625 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

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

    File WizardGUI.py has 618 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Function run has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self):
              tokens = tokenize.generate_tokens(self.getline)
              for _token in tokens:
                  self.tokeneater(*_token)
              # Remove trailing empty lines.
      Severity: Minor
      Found in reindent.py - About 1 day to fix

      Cognitive Complexity

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

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

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

      Further reading

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

      # -*- coding: Latin-1 -*-
      ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
      # DEVS.py --- Classes and Tools for DEVS Model Specification
      #                     --------------------------------
      #                            Copyright (c) 2013
      Severity: Major
      Found in DEVSKernel/PyPDEVS/old/DEVS.py - About 1 day to fix

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

        DEVSKernel/PyPDEVS/old/examples/trafficLightExperiment.py on lines 0..87

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

        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/trafficLightExperiment.py and 1 other location - About 1 day to fix
        DEVSKernel/PyPDEVS/pypdevs221/examples/trafficLightExperiment.py on lines 0..87

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

        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 whichgen has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
        Open

        def whichgen(command, path=None, verbose=0, exts=None):
            """Return a generator of full paths to the given command.
            
            "command" is a the name of the executable to search for.
            "path" is an optional alternate path list to search. The default it
        Severity: Minor
        Found in which.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

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

                    elif isinstance(menu, SettingsMenu):
                    
                        if wx.VERSION_STRING < '4.0':
                            ### Before Pnoenix Transition
                            ### if item exist, we delete him
        Severity: Major
        Found in Menu.py and 1 other location - About 1 day to fix
        Menu.py on lines 589..607

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

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

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

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

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

        Refactorings

        Further Reading

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

                    if isinstance(menu, FileMenu):
                                
                        if wx.VERSION_STRING < '4.0':
                            ### Before Phoenix Transition
                            ### if item exist, we delete him
        Severity: Major
        Found in Menu.py and 1 other location - About 1 day to fix
        Menu.py on lines 609..627

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

        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

        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

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

              def OnDownWard(self, event):
                  """
                  """
          
                          ### toolbar object
          Severity: Major
          Found in devsimpy.py and 1 other location - About 1 day to fix
          devsimpy.py on lines 1046..1074

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

          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 var in range(len(self.vcd_varList)):
                      self.vcd_file.write(("b").encode())
                      if self.vcd_varList[var].bitSize is None:
                          # The wire is a constant error signal, so the wire is never used
                          # Assume 1 bit long
          Severity: Major
          Found in DEVSKernel/PyPDEVS/old/tracers.py and 1 other location - About 1 day to fix
          DEVSKernel/PyPDEVS/pypdevs221/src/tracerVCD.py on lines 105..114

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

          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 var in range(len(self.vcd_varList)):
                      self.vcd_file.write(("b").encode())
                      if self.vcd_varList[var].bitSize is None:
                          # The wire is a constant error signal, so the wire is never used
                          # Assume 1 bit long
          Severity: Major
          Found in DEVSKernel/PyPDEVS/pypdevs221/src/tracerVCD.py and 1 other location - About 1 day to fix
          DEVSKernel/PyPDEVS/old/tracers.py on lines 521..530

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

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

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

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

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

          Refactorings

          Further Reading

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

              def OnUpWard(self, event):
                  """
                  """
          
                  ### toolbar object
          Severity: Major
          Found in devsimpy.py and 1 other location - About 1 day to fix
          devsimpy.py on lines 1077..1105

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

          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 simulator_factory has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
          Open

          def simulator_factory(model, strategy, prof, ntl, verbose, dynamic_structure_flag, real_time_flag):
              """ Preventing direct creation for Simulator
                  disallow direct access to the classes
              """
          
          
          Severity: Minor
          Found in Patterns/Factory.py - About 1 day to fix

          Cognitive Complexity

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

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

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

          Further reading

          File simulator.py has 565 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: Latin-1 -*-
          """
          Main simulator class to be used as an interface to the user
          """
          
          
          Severity: Major
          Found in DEVSKernel/PyPDEVS/pypdevs221/src/simulator.py - About 1 day to fix

            Function guessDelimiter has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
            Open

            def guessDelimiter(input, textQualifier = '"'):
                """
                PROTOTYPE:
                  guessDelimiter(input, textQualifier = '\"')
                DESCRIPTION:
            Severity: Minor
            Found in DSV.py - About 1 day to fix

            Cognitive Complexity

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

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

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

            Further reading

            Function allocate has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
            Open

                def allocate(self, models, edges, nrnodes, totalActivities):
                    """
                    Calculate allocations for the nodes, using the information provided.
            
                    :param models: the models to allocte
            Severity: Minor
            Found in DEVSKernel/PyPDEVS/pypdevs221/src/greedyAllocator.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

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

                    for I in range(len(aDEVS.OPorts)):
                        if aDEVS.OPorts[I] in aDEVS.myOutput and aDEVS.myOutput[aDEVS.OPorts[I]] is not None:
                            portInfo += "<port name=\""+ aDEVS.OPorts[I].getPortName()+"\" category=\"O\">\n"
                            for j in aDEVS.myOutput[aDEVS.OPorts[I]]:
                                portInfo += "<message>" + str(j) + "</message>\n</port>\n"
            Severity: Major
            Found in DEVSKernel/PyPDEVS/old/tracers.py and 1 other location - About 1 day to fix
            DEVSKernel/PyPDEVS/pypdevs221/src/tracerXML.py on lines 71..75

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

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

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

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

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

            Refactorings

            Further Reading

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

                        if val == _('Generator'):
            
                            ### no input and
                            vbox2.GetItem(5).GetWindow().SetValue(0)
                            ### update output
            Severity: Major
            Found in WizardGUI.py and 1 other location - About 1 day to fix
            WizardGUI.py on lines 668..681

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

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

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

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

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

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language