avaframe/AvaFrame

View on GitHub
avaframe/com1DFA/com1DFA.py

Summary

Maintainability
F
1 wk
Test Coverage
A
91%

File com1DFA.py has 2154 lines of code (exceeds 300 allowed). Consider refactoring.
Confirmed

"""
    Main functions for python DFA kernel
"""

import copy
Severity: Major
Found in avaframe/com1DFA/com1DFA.py - About 5 days to fix

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

    def prepareVarSimDict(standardCfg, inputSimFiles, variationDict, simNameExisting=""):
        """Prepare a dictionary with simulations that shall be run with varying parameters following the variation dict
    
        Parameters
        -----------
    Severity: Minor
    Found in avaframe/com1DFA/com1DFA.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 DFAIterate has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    def DFAIterate(cfg, particles, fields, dem, inputSimLines, simHash=""):
        """Perform time loop for DFA simulation
         Save results at desired intervals
    
        Parameters
    Severity: Minor
    Found in avaframe/com1DFA/com1DFA.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 initializeParticles has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def initializeParticles(cfg, releaseLine, dem, inputSimLines="", logName="", relThField=""):
        """Initialize DFA simulation
    
        Create particles and fields dictionary according to config parameters
        release raster and dem
    Severity: Minor
    Found in avaframe/com1DFA/com1DFA.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 getSimTypeList has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def getSimTypeList(standardCfg, simTypeList, inputSimFiles):
        """Define available simulation types of requested types
    
        Parameters
        -----------
    Severity: Minor
    Found in avaframe/com1DFA/com1DFA.py - About 2 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 exportFields has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def exportFields(cfg, Tsave, fieldsList, dem, outDir, logName):
        """export result fields to Outputs directory according to result parameters and time step
        that can be specified in the configuration file
    
        Parameters
    Severity: Minor
    Found in avaframe/com1DFA/com1DFA.py - About 2 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 readFields has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def readFields(inDir, resType, simName="", flagAvaDir=True, comModule="com1DFA", timeStep="", atol=1.0e-6):
        """Read ascii files within a directory and return List of dictionaries
    
        Parameters
        -----------
    Severity: Minor
    Found in avaframe/com1DFA/com1DFA.py - About 2 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 initializeParticles has 62 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

    def initializeParticles(cfg, releaseLine, dem, inputSimLines="", logName="", relThField=""):
        """Initialize DFA simulation
    
        Create particles and fields dictionary according to config parameters
        release raster and dem
    Severity: Major
    Found in avaframe/com1DFA/com1DFA.py - About 2 hrs to fix

      Function DFAIterate has 54 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

      def DFAIterate(cfg, particles, fields, dem, inputSimLines, simHash=""):
          """Perform time loop for DFA simulation
           Save results at desired intervals
      
          Parameters
      Severity: Major
      Found in avaframe/com1DFA/com1DFA.py - About 1 hr to fix

        Function initializeFields has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        def initializeFields(cfg, dem, particles, releaseLine):
            """Initialize fields and update particles flow thickness. Eventually build bond array if snowSlide is activated
        
            Parameters
            ----------
        Severity: Minor
        Found in avaframe/com1DFA/com1DFA.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

        Function createReportDict has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        def createReportDict(avaDir, logName, relName, inputSimLines, cfg, reportAreaInfo):
            """create simulaton report dictionary
        
            Parameters
            ----------
        Severity: Minor
        Found in avaframe/com1DFA/com1DFA.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

        Function prepareInputData has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        def prepareInputData(inputSimFiles, cfg):
            """Fetch input data
        
            Parameters
            ----------
        Severity: Minor
        Found in avaframe/com1DFA/com1DFA.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

        Function initializeSimulation has 38 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

        def initializeSimulation(cfg, outDir, demOri, inputSimLines, logName):
            """create simulaton report dictionary
        
            Parameters
            ----------
        Severity: Minor
        Found in avaframe/com1DFA/com1DFA.py - About 1 hr to fix

          Function initializeSimulation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def initializeSimulation(cfg, outDir, demOri, inputSimLines, logName):
              """create simulaton report dictionary
          
              Parameters
              ----------
          Severity: Minor
          Found in avaframe/com1DFA/com1DFA.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

          Function setThickness has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def setThickness(cfg, lineTh, typeTh):
              """set thickness in line dictionary of release, entrainment, second. release
          
              Parameters
              -----------
          Severity: Minor
          Found in avaframe/com1DFA/com1DFA.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

          Function com1DFACore has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def com1DFACore(cfg, avaDir, cuSimName, inputSimFiles, outDir, simHash=""):
              """Run main com1DFA model
          
              This will compute a dense flow avalanche with the settings specified in cfg and the name cuSimName
          
          
          Severity: Minor
          Found in avaframe/com1DFA/com1DFA.py - About 45 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 readFields has 7 arguments (exceeds 6 allowed). Consider refactoring.
          Open

          def readFields(inDir, resType, simName="", flagAvaDir=True, comModule="com1DFA", timeStep="", atol=1.0e-6):
          Severity: Major
          Found in avaframe/com1DFA/com1DFA.py - About 35 mins to fix

            Function computeEulerTimeStep has 7 arguments (exceeds 6 allowed). Consider refactoring.
            Open

            def computeEulerTimeStep(cfg, particles, fields, zPartArray0, dem, tCPU, frictType):
            Severity: Major
            Found in avaframe/com1DFA/com1DFA.py - About 35 mins to fix

              Function com1DFAPostprocess has 7 arguments (exceeds 6 allowed). Consider refactoring.
              Invalid

              def com1DFAPostprocess(simDF, tCPUDF, simDFExisting, cfgMain, dem, reportDictList, exportData):
              Severity: Major
              Found in avaframe/com1DFA/com1DFA.py - About 35 mins to fix

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

                def initializeRelVol(cfg, demVol, releaseFile, radius, releaseType="primary"):
                    """initialize release line and apply thickness to compute release volume
                
                    Parameters
                    cfg: dict
                Severity: Minor
                Found in avaframe/com1DFA/com1DFA.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 computeEulerTimeStep has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def computeEulerTimeStep(cfg, particles, fields, zPartArray0, dem, tCPU, frictType):
                    """compute next time step using an euler forward scheme
                
                    Parameters
                    ----------
                Severity: Minor
                Found in avaframe/com1DFA/com1DFA.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 com1DFAMain has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Wontfix

                def com1DFAMain(cfgMain, cfgInfo=""):
                    """preprocess information from ini and run all desired simulations, create outputs and reports
                
                    Parameters
                    ------------
                Severity: Minor
                Found in avaframe/com1DFA/com1DFA.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 prepareReleaseEntrainment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Invalid

                def prepareReleaseEntrainment(cfg, rel, inputSimLines):
                    """set thickness values for release, secondary release and entrainment
                        set flag to append _AF to release scenario name if it includes an underscore
                
                    Parameters
                Severity: Minor
                Found in avaframe/com1DFA/com1DFA.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