espressopp/espressopp

View on GitHub

Showing 485 of 1,134 total issues

Function read has a Cognitive Complexity of 273 (exceeds 5 allowed). Consider refactoring.
Open

def read(gro_file, top_file="", doRegularExcl=True):
    """ Read GROMACS data files.

    Arguments:
    :param gro_file: -- contains coordinates of all particles, the number of particles, velocities and box size.
Severity: Minor
Found in src/tools/gromacs.py - About 5 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 nodeGrid has a Cognitive Complexity of 225 (exceeds 5 allowed). Consider refactoring.
Open

def nodeGrid(n=None, box_size=None, rc=None, skin=None, eh_size=0, ratioMS=0, idealGas=0, slabMSDims=[0, 0, 0,]):
    if isinstance(n, numbers.Number) and box_size is None:
        return nodeGridSimple(n)
    else:
        if eh_size!=0:
Severity: Minor
Found in src/tools/decomp.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 transformations.py has 1494 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
***********************************
espressopp.external.transformations
***********************************

Severity: Major
Found in src/external/transformations.py - About 3 days to fix

    File gromacs.py has 1100 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #  Copyright (C) 2012,2013,2015(H),2016
    #      Max Planck Institute for Polymer Research
    #  Copyright (C) 2008,2009,2010,2011
    #      Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
    #
    Severity: Major
    Found in src/tools/gromacs.py - About 2 days to fix

      Function reDistCells has a Cognitive Complexity of 136 (exceeds 5 allowed). Consider refactoring.
      Open

      def reDistCells(halfNeilListX, cellsX, eh_size, rc_skin, node_gridX, ratioMS, sizeX, idealGas, halfCellInt = 1):
          #global preFactCen
          preFactCen = 1.0
          print("HeSpaDDA message: Cells redistribution will improve whenever the Cells1D are at least twice as big as Nodes1D!")
          wholeNeiListX = []
      Severity: Minor
      Found in src/tools/loadbal.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 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

      File pmi.py has 989 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #  Copyright (C) 2012,2013
      #      Max Planck Institute for Polymer Research
      #  Copyright (C) 2008,2009,2010,2011
      #      Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
      #
      Severity: Major
      Found in src/pmi.py - About 2 days to fix

        Function read has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
        Open

        def read(file):
            """ Read ESPResSo data files.
        
            Keyword argument:
            file -- contains simulation variables, data of all particles, and information about bonds.
        Severity: Minor
        Found in src/tools/espresso_old.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 LennardJones.py has 844 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #  Copyright (C) 2012-2018
        #      Max Planck Institute for Polymer Research
        #  Copyright (C) 2008-2011
        #      Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
        #
        Severity: Major
        Found in src/interaction/LennardJones.py - About 2 days to fix

          Function createPathintegralSystem has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
          Open

          def createPathintegralSystem(allParticles,
          props,
          types,
          system,
          exclusions,
          Severity: Minor
          Found in src/tools/pathintegral.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 Tabulated.py has 669 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          #  Copyright (C) 2017,2018
          #      Max Planck Institute for Polymer Research
          #  Copyright (C) 2016
          #      Jakub Krajniak (jkrajniak at gmail.com)
          #  Copyright (C) 2012,2013,2014,2015
          Severity: Major
          Found in src/interaction/Tabulated.py - About 1 day to fix

            Function read_charmm has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
            Open

            def read_charmm(fin):
            
                f = open(fin)
                line = f.readline() # comment line
                while not 'atoms' in line: #skip possible blank line
            Severity: Minor
            Found in src/tools/lammps.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 polymerRW has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
            Open

            def polymerRW(pid, startpos, numberOfMonomers, bondlength, return_angles=False, return_dihedrals=False, mindist=None, rng=None):
                """
                Initializes polymers through random walk
                """
            
            
            Severity: Minor
            Found in src/tools/topology.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 write has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
            Open

            def write(fileName, system, folded=True, writeVelocities=False):
            
                # first collect all the information that we need to write into the file
                numParticles  = int(espressopp.analysis.NPart(system).compute())
                box_x = system.bc.boxL[0]
            Severity: Minor
            Found in src/tools/io_extended.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 storeImpropers has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

            def storeImpropers(f, types, impropertypes, impropertypeparams, impropers, num_atoms_molecule, num_molecule_copies, molstartindex, atomtype_wildcard):
                print('#Warning! This parser of the improper angles section of gromacs-format forcefield files is for the Amber forcefield only. Other forcefields may have a different atom ordering. See storeImpropers in gromacs.py for further details.')
                line = ''
                impropers_tmp = []
                pos = f.tell()
            Severity: Minor
            Found in src/tools/gromacs.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 write has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

            def write(fout, system, writeVelocities=False):
            
                # first collect all the information that we need to write into the file
                numParticles  = int(espressopp.analysis.NPart(system).compute())
                box_x = system.bc.boxL[0]
            Severity: Minor
            Found in src/tools/lammps.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 createPathintegralSystem has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

            def createPathintegralSystem(allParticles,
            props,
            types,
            system,
            langevin,
            Severity: Minor
            Found in testsuite/pi_water/pathintegral.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 update has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
            Open

                def update(self):
                    """Load data from the buffer and store in the HDF5 file."""
                    if pmi.workerIsActive():
                        raw_data = self.cxxclass.get_data(self)
                        step_data = {}
            Severity: Minor
            Found in src/io/DumpTopology.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 findNodesMS has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
            Open

            def findNodesMS(node_gridX, totCellsEH, totCellsCG, ratioMS, sizeX, eh_size, idealGas, procsWEH=1.):
                fRatioEH = pow(ratioMS, 1. / 3.) * (2.0 * eh_size / (1.0 * (sizeX) + 2.0 * eh_size * (pow(ratioMS, 1. / 3.) - 1.)))  # Seems to be wo Bu!
                # pow(ratioMS,1./3.)*(1.0*totCellsEH/(1.0*(totCellsCG+totCellsEH)+totCellsEH*(pow(ratioMS,1./3.)-1.)))
                # fRatioCG=(1./1.)*(1.0*totCellsCG/(1.0*(totCellsCG+totCellsEH)))
                if idealGas:
            Severity: Minor
            Found in src/tools/loadbal.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 psfwrite has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
            Open

            def psfwrite(filename, system, maxdist=None, molsize=4, typenames=None):
                #if not all molecules have the same number of atoms, set molsize=0
                file = open(filename,'w')
                maxParticleID = int(espressopp.analysis.MaxPID(system).compute())
                nParticles    = int(espressopp.analysis.NPart(system).compute())
            Severity: Minor
            Found in src/tools/psf.py - About 7 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

            Severity
            Category
            Status
            Source
            Language