espressopp/espressopp

View on GitHub
src/storage/Storage.py

Summary

Maintainability
F
4 days
Test Coverage

Function addParticles has a Cognitive Complexity of 124 (exceeds 5 allowed). Consider refactoring.
Open

    def addParticles(self, particleList, *properties):
        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():

            index_id          = -1
            index_pos         = -1
Severity: Minor
Found in src/storage/Storage.py - About 2 days to fix

Cognitive Complexity

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

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

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

Further reading

Function addParticlesArray has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    def addParticlesArray(self, particleList, *properties):

        if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():

            index_id          = -1
Severity: Minor
Found in src/storage/Storage.py - About 6 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

File Storage.py has 435 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#  Copyright (C) 2012,2013,2014,2015,2016,2017,2018
#      Max Planck Institute for Polymer Research
#  Copyright (C) 2008,2009,2010,2011
#      Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
Severity: Minor
Found in src/storage/Storage.py - About 6 hrs to fix

    Function modifyParticle has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def modifyParticle(self, pid, property, value):
            if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
                if self.particleExists(pid):
                    particle = self.getParticle(pid)
                    self.logger.info("particle pid=%i rank=%i" % (pid, pmi.rank))
    Severity: Minor
    Found in src/storage/Storage.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

            def addParticle(self, pid, pos, checkexist=True):
                if checkexist:
                    if self.particleExists(pid):
                        print("WARNING: Particle ", pid, " already exists. Therefore it was not added.")
                        return None
    Severity: Minor
    Found in src/storage/Storage.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 particleExists has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def particleExists(self, pid):
            if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup():
                if self.cxxclass.lookupRealParticle(self, pid):
                    return True
                else:
    Severity: Minor
    Found in src/storage/Storage.py - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    There are no issues that match your filters.

    Category
    Status