capocchi/DEVSimPy

View on GitHub
DEVSKernel/PyDEVS/DEVS.py

Summary

Maintainability
D
3 days
Test Coverage

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

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

## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
# DEVS.py --- Class and Tools for 'Classic' DEVS Model Specification
#                     --------------------------------
Severity: Minor
Found in DEVSKernel/PyDEVS/DEVS.py - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

            if ((p1.host.parent == self and p2.host.parent == self) and (isinstance(p1, OPort) and isinstance(p2, IPort))):
                if p1.host == p2.host:
                    Error('Direct feedback coupling parent not allowed', 1)
                else:
                    self.IC.append( ( (p1.host, p1), (p2.host, p2) ) )
    Severity: Critical
    Found in DEVSKernel/PyDEVS/DEVS.py - About 2 hrs to fix

      Function connectPorts has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def connectPorts(self, p1, p2):
              """Connects two ports together. The coupling is to begin at {\tt p1} and
              to end at {\tt p2}.
      
              NOTE: connections should eventually be implemented as objects, which
      Severity: Minor
      Found in DEVSKernel/PyDEVS/DEVS.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

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

          def addOutPort(self, name=None):
              """Add an {\sl output port\/} to the DEVS model.
      
                  See comments for {\tt addInPort} above.
              """
      Severity: Major
      Found in DEVSKernel/PyDEVS/DEVS.py and 1 other location - About 3 hrs to fix
      DEVSKernel/PyDEVS/DEVS.py on lines 100..118

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

      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 addInPort(self, name=None):
              """Add an {\sl input port\/} to the DEVS model.
      
                  {\tt addInPort} and {\tt addOutPort} are the {\sl only\/} proper way to
                  add I/O ports to DEVS. As for {\tt CoupledDEVS.addSubModel} method, calls
      Severity: Major
      Found in DEVSKernel/PyDEVS/DEVS.py and 1 other location - About 3 hrs to fix
      DEVSKernel/PyDEVS/DEVS.py on lines 121..132

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

      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

      class IPort(Port):
          """ Input DEVS Port
          """
      
          def __init__(self, name=""):
      Severity: Major
      Found in DEVSKernel/PyDEVS/DEVS.py and 1 other location - About 3 hrs to fix
      DEVSKernel/PyDEVS/DEVS.py on lines 504..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 63.

      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

      class OPort(Port):
          """ Output DEVS Port
          """
      
          def __init__(self, name=""):
      Severity: Major
      Found in DEVSKernel/PyDEVS/DEVS.py and 1 other location - About 3 hrs to fix
      DEVSKernel/PyDEVS/DEVS.py on lines 487..501

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

      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 p1.host == p2.host:
                      Error('Direct feedback coupling parent not allowed', 1)
                  else:
                      self.IC.append( ( (p1.host, p1), (p2.host, p2) ) )
                      p1.outLine.append(p2)
      Severity: Major
      Found in DEVSKernel/PyDEVS/DEVS.py and 1 other location - About 1 hr to fix
      DEVSKernel/PyPDEVS/old/DEVS.py on lines 570..582

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

      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 4 locations. Consider refactoring.
      Open

              elif ((p1.host.parent == self and p2.host == self) and (isinstance(p1, OPort) and isinstance(p2, OPort))):
                  self.EOC.append( ( (p1.host, p1), (p2.host, p2) ) )
                  p1.outLine.append(p2)
                  p2.inLine.append(p1)
      Severity: Major
      Found in DEVSKernel/PyDEVS/DEVS.py and 3 other locations - About 1 hr to fix
      DEVSKernel/PyDEVS/DEVS.py on lines 364..367
      DEVSKernel/PyPDEVS/old/DEVS.py on lines 585..589
      DEVSKernel/PyPDEVS/old/DEVS.py on lines 592..596

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

      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 4 locations. Consider refactoring.
      Open

              elif ((p1.host == self and p2.host.parent == self) and (isinstance(p1, IPort) and isinstance(p2, IPort))):
                  self.EIC.append( ( (p1.host, p1), (p2.host, p2) ) )
                  p1.outLine.append(p2)
                  p2.inLine.append(p1)
      Severity: Major
      Found in DEVSKernel/PyDEVS/DEVS.py and 3 other locations - About 1 hr to fix
      DEVSKernel/PyDEVS/DEVS.py on lines 370..373
      DEVSKernel/PyPDEVS/old/DEVS.py on lines 585..589
      DEVSKernel/PyPDEVS/old/DEVS.py on lines 592..596

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

      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