avaframe/AvaFrame

View on GitHub

Showing 280 of 937 total issues

Function visuRunoutStat has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

def visuRunoutStat(rasterTransfo, inputsDF, resAnalysisDF, newRasters, cfgSetup, pathDict):
    """
    Panel1 reference peak field with runout points of all sims and distribution of runout SXY
    Panel 2 crossMax values of peak field along thalweg for all sims
    Panel 3 mean, median and envelope of cross max values for all sims
Severity: Minor
Found in avaframe/out3Plot/outAIMEC.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 outQuickPlot.py has 477 lines of code (exceeds 300 allowed). Consider refactoring.
Open

"""
Functions to plot 2D avalanche simulation results as well as comparison plots
between two datasets of identical shape.

"""
Severity: Minor
Found in avaframe/out3Plot/outQuickPlot.py - About 6 hrs to fix

    File cfgHandling.py has 463 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    """
        Utilities for working with cfg info
    """
    Severity: Minor
    Found in avaframe/in3Utils/cfgHandling.py - About 5 hrs to fix

      File statsPlots.py has 459 lines of code (exceeds 300 allowed). Consider refactoring.
      Open

      """
          plot statistics of simulations
      
      """
      
      
      Severity: Minor
      Found in avaframe/out3Plot/statsPlots.py - About 5 hrs to fix

        Function splitIniValueToArraySteps has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

        def splitIniValueToArraySteps(cfgValues, returnList=False):
            """ read values in ini file and return numpy array or list if the items are strings;
                values can either be separated by | or provided in start:end:numberOfSteps format
                if separated by : or $ also optional add one additional value using &
                if format of refVal$percent$steps is used - an array is created with +- percent of refVal in nsteps
        Severity: Minor
        Found in avaframe/in3Utils/fileHandlerUtils.py - About 5 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 placeParticles has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

        def placeParticles(hCell, aCell, indx, indy, csz, massPerPart, nPPK, rng, cfg, ratioArea):
            """ Create particles in given cell
        
            Compute number of particles to create in a given cell.
            Place particles in cell according to the chosen pattern (random semirandom
        Severity: Minor
        Found in avaframe/com1DFA/particleTools.py - About 5 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 ana3AIMEC.py has 434 lines of code (exceeds 300 allowed). Consider refactoring.
        Open

        """
            AIMEC post processing workflow
        """
        
        import logging
        Severity: Minor
        Found in avaframe/ana3AIMEC/ana3AIMEC.py - About 5 hrs to fix

          File generateTopo.py has 426 lines of code (exceeds 300 allowed). Consider refactoring.
          Open

          """
            Create generic/idealised topographies
          """
          
          
          
          Severity: Minor
          Found in avaframe/in3Utils/generateTopo.py - About 5 hrs to fix

            Function splitVariationToArraySteps has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            def splitVariationToArraySteps(value, key, fullCfg):
                """ split variation in percent to create a list of factors to set parameter value for variations
                    or if a rangeVariation is given in absolute values
                    or if distVariation create an info string on how the distribution can be build
                    (e.g. of format typeOfDistribution$numberOfSteps$ci95value$ci95$support and append the step
            Severity: Minor
            Found in avaframe/com1DFA/deriveParameterSet.py - About 4 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 outCom1DFA.py has 401 lines of code (exceeds 300 allowed). Consider refactoring.
            Open

            import numpy as np
            import pathlib
            import matplotlib.pyplot as plt
            import logging
            from matplotlib.animation import FuncAnimation, PillowWriter
            Severity: Minor
            Found in avaframe/out3Plot/outCom1DFA.py - About 4 hrs to fix

              Function getVariationDict has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

              def getVariationDict(avaDir, fullCfg, modDict):
                  """ Create a dictionary with all the parameters that shall be varied from the standard configuration;
                      ONLY accounts for variations in section GENERAL and INPUT/releaseScenario
              
                      Parameters
              Severity: Minor
              Found in avaframe/com1DFA/deriveParameterSet.py - About 4 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 writeCompareReport has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

              def writeCompareReport(reportFile, reportD, benchD, avaName, cfgRep):
                  """ Write a report in markdown format of the comparison of simulations to reference simulation results;
                      report is saved to location of reportFile
              
              
              
              Severity: Minor
              Found in avaframe/log2Report/generateCompareReport.py - About 4 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 filterBenchmarks has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

              def filterBenchmarks(testDictList, filterType, valuesList, condition='or'):
                  """ filter benchmarks according to characteristic
              
                      Parameters
                      -----------
              Severity: Minor
              Found in avaframe/ana1Tests/testUtilities.py - About 4 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 shpConversion.py has 394 lines of code (exceeds 300 allowed). Consider refactoring.
              Open

              """
                  Conversion functions to read/ write Shape files
              """
              
              
              
              Severity: Minor
              Found in avaframe/in2Trans/shpConversion.py - About 4 hrs to fix

                Function plotContoursFromDict has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                Open

                def plotContoursFromDict(contourDictRef, contourDictSim, pathDict, levels, multiplePlots=True):
                    """ plot contour lines of two contourLine dicts only plot lines that are available within ref
                        and save to file
                
                        Parameters
                Severity: Minor
                Found in avaframe/out3Plot/outContours.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 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

                File com1DFAOrig.py has 372 lines of code (exceeds 300 allowed). Consider refactoring.
                Open

                """
                    Python wrapper to execute the compiled com1Exe file and set desired simulation options
                """
                
                # Load modules
                Severity: Minor
                Found in avaframe/com1DFAOrig/com1DFAOrig.py - About 3 hrs to fix

                  Function generateCom1DFAEnergyPlot has 97 lines of code (exceeds 30 allowed). Consider refactoring.
                  Open

                  def generateCom1DFAEnergyPlot(avalancheDir, energyLineTestCfg, com1DFACfg, avaProfileMass, dem, fieldsList, simName):
                      """ Make energy test analysis and plot results
                  
                      Parameters
                      -----------
                  Severity: Major
                  Found in avaframe/ana1Tests/energyLineTest.py - About 3 hrs to fix

                    Function plotProbMap has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def plotProbMap(avaDir, inDir, cfgFull, demPlot=False):
                        """ plot probability maps including contour lines
                    
                            Parameters
                            ----------
                    Severity: Minor
                    Found in avaframe/out3Plot/statsPlots.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

                    Severity
                    Category
                    Status
                    Source
                    Language