avaframe/AvaFrame

View on GitHub

Showing 281 of 942 total issues

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

def makeColorMap(colormapDict, levMin, levMax, continuous=False):
    """Get colormap for plot

    get the colormap, norm, levels... for ploting results

Severity: Minor
Found in avaframe/out3Plot/plotUtils.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 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

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

def writeReport(outDir, reportDictList, reportOneFile, plotDict='', standaloneReport=False,
                reportName='fullSimulationReport'):
    """ Write a report in markdown format for simulations, saved to outDir

        Parameters
Severity: Minor
Found in avaframe/log2Report/generateReport.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 updateCfgRange has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

def updateCfgRange(cfg, cfgProb, varName, varDict):
    """ update cfg with a range for parameters in cfgProb

        Parameters
        -----------
Severity: Minor
Found in avaframe/ana4Stats/probAna.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 generatePlot has 89 lines of code (exceeds 30 allowed). Consider refactoring.
Open

def generatePlot(dataDict, avaName, outDir, cfg, plotDict, crossProfile=True):
    """ Create comparison plots of two ascii datasets

        This function creates two plots, one plot with four panels with, first dataset, second dataset,
        the absolute difference of the two datasets and the absolute difference capped to a smaller range
Severity: Major
Found in avaframe/out3Plot/outQuickPlot.py - About 3 hrs to fix

    Function checkCfgFrictionModel has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def checkCfgFrictionModel(cfg, relVolume=''):
        """ check which friction model is chosen and if friction model parameters are of valid type
            if samosATAuto - check if
    
            relVolume < volClassSmall - set frictModel=samosATSmall
    Severity: Minor
    Found in avaframe/com1DFA/checkCfg.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 visuComparison has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def visuComparison(rasterTransfo, inputs, pathDict):
        """
        Plot and save the comparison between current simulation and Reference
        in the runout area
    
    
    Severity: Minor
    Found in avaframe/out3Plot/outAIMEC.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 makeSimDF has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def makeSimDF(inputDir, avaDir='', simID='simID'):
        """ Create a  dataFrame that contains all info on simulations
    
            this can then be used to filter simulations for example
    
    
    Severity: Minor
    Found in avaframe/in3Utils/fileHandlerUtils.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 extractMaxValues has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def extractMaxValues(inputDir, avaDir, varPar, restrictType='', nameScenario='', parametersDict=''):
        """ Extract max values of result parameters and save to dictionary
    
            - optionally restrict data of peak fields by defining which result parameter with restrictType,
              provide nameScenario and a parametersDict to filter simulations
    Severity: Minor
    Found in avaframe/ana4Stats/getStats.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 updateThicknessCfg has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def updateThicknessCfg(inputSimFiles, cfgInitial):
        """add available release scenarios to ini file and
        set thickness values in ini files
    
        Parameters
    Severity: Minor
    Found in avaframe/in1Data/getInput.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 makeSimFromResDF has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def makeSimFromResDF(avaDir, comModule, inputDir='', simName=''):
        """ Create a  dataFrame that contains all info on simulations in output/comModule/peakFiles
    
            One line for each simulation - so all peakfiles that belong to one simulation are listed in one line
            that corresponds to that simulation
    Severity: Minor
    Found in avaframe/in3Utils/fileHandlerUtils.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 plotDamBreakSummary has 80 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

    def plotDamBreakSummary(
        avalancheDir,
        timeList,
        fieldsList,
        fieldHeader,
    Severity: Major
    Found in avaframe/out3Plot/outAna1Plots.py - About 3 hrs to fix

      Function applyCfgOverride has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      def applyCfgOverride(cfgToOverride, cfgWithOverrideParameters, module, addModValues=False):
          """override configuration parameter values with the values provided in cfgWithOverrideParameters[modName_override]
          if addModValues True update the cfgWithOverrideParameters with the values for all parameters that are not
          provided in the override parameters
      
      
      Severity: Minor
      Found in avaframe/in3Utils/cfgHandling.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 setThicknessValueFromVariation has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      def setThicknessValueFromVariation(key, cfg, simType, row):
          """ set thickness value for thickness parameter for all features if multiple according to
              desired variation
      
              Parameters
      Severity: Minor
      Found in avaframe/com1DFA/deriveParameterSet.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

      File com2AB.py has 329 lines of code (exceeds 300 allowed). Consider refactoring.
      Open

      """
          Main module for Alpha beta
      
      """
      
      Severity: Minor
      Found in avaframe/com2AB/com2AB.py - About 2 hrs to fix

        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 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 extractFrontAndMeanValuesTT has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        def extractFrontAndMeanValuesTT(cfgRangeTime, flowF, demHeader, mtiInfo):
            """ extract avalanche front and mean values of flow parameter result field
                used for colorcoding range-time diagram
        
                Parameters
        Severity: Minor
        Found in avaframe/ana5Utils/distanceTimeAnalysis.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 generateCom1DFAPathPlot has 67 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

        def generateCom1DFAPathPlot(avalancheDir, cfgPath, avaProfileMass, dem, parabolicFit, splitPoint, simName):
            """ Make energy test analysis and plot results
        
            Parameters
            -----------
        Severity: Major
        Found in avaframe/out3Plot/outCom3Plots.py - About 2 hrs to fix
          Severity
          Category
          Status
          Source
          Language