avaframe/AvaFrame

View on GitHub

Showing 914 of 942 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if inputSimFiles["secondaryReleaseFile"] != None and "secondaryReleaseFile" in thTypeList:
        cfgInitial = dP.getThicknessValue(
            cfgInitial, inputSimFiles, inputSimFiles["secondaryReleaseFile"].stem, "secondaryRelTh"
        )
        cfgInitial["INPUT"]["secondaryReleaseScenario"] = inputSimFiles["secondaryReleaseFile"].stem
Severity: Major
Found in avaframe/in1Data/getInput.py and 1 other location - About 4 hrs to fix
avaframe/in1Data/getInput.py on lines 401..403

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 74.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if inputSimFiles["entFile"] != None and "entFile" in thTypeList:
        cfgInitial = dP.getThicknessValue(cfgInitial, inputSimFiles, inputSimFiles["entFile"].stem, "entTh")
        cfgInitial["INPUT"]["entrainmentScenario"] = inputSimFiles["entFile"].stem
Severity: Major
Found in avaframe/in1Data/getInput.py and 1 other location - About 4 hrs to fix
avaframe/in1Data/getInput.py on lines 404..408

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 74.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

        Ny[0, 0] = (z[0, 1] - z[1, 1] - (z[1, 0] - z[0, 0])) / csz
Severity: Major
Found in avaframe/in3Utils/geoTrans.py and 3 other locations - About 4 hrs to fix
avaframe/in3Utils/geoTrans.py on lines 1714..1714
avaframe/in3Utils/geoTrans.py on lines 1715..1715
avaframe/in3Utils/geoTrans.py on lines 1763..1763

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 74.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if len(sizeList) > 1:
        sizeList = (simDF[sizedBy].to_numpy() - minSize) / (maxSize - minSize) * 70 + 10
    else:
        sizeList = np.array([100])
Severity: Major
Found in avaframe/out3Plot/outAna1Plots.py and 1 other location - About 3 hrs to fix
avaframe/out3Plot/outAna1Plots.py on lines 1193..1196

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if len(sizeList) > 1:
            sizeList = (simDFNew[sizedBy].to_numpy() - minSize) / (maxSize - minSize) * 70 + 10
        else:
            sizeList = np.array([100])
Severity: Major
Found in avaframe/out3Plot/outAna1Plots.py and 1 other location - About 3 hrs to fix
avaframe/out3Plot/outAna1Plots.py on lines 1292..1295

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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 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

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 animationPlot has 96 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

      def animationPlot(demData, data, cellSize, resType, cfgRangeTime, mtiInfo, timeStep):
          """3 panel plot: result in x,y, result in s, l, tt diagram
      
          Parameters
          -----------
      Severity: Major
      Found in avaframe/out3Plot/outDistanceTimeAnalysis.py - About 3 hrs to fix

        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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            if lenSize > 1:
                sizeList = (simDF[sizedBy].to_numpy() - minSize) / (maxSize - minSize) * 70 + 10
            else:
                sizeList = np.array([100])
        Severity: Major
        Found in avaframe/out3Plot/outAna1Plots.py and 1 other location - About 3 hrs to fix
        avaframe/out3Plot/outAna1Plots.py on lines 1168..1171

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            if lenSize > 1:
                sizeList = (simDF[sizedBy].to_numpy() - minSize) / (maxSize - minSize) * 70 + 10
            else:
                sizeList = np.array([100])
        Severity: Major
        Found in avaframe/out3Plot/outAna1Plots.py and 1 other location - About 3 hrs to fix
        avaframe/out3Plot/outAna1Plots.py on lines 1049..1052

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    yFeat = lineDict["y"][
                        int(lineDict["Start"][lineFeature]) : int(
                            lineDict["Start"][lineFeature] + lineDict["Length"][lineFeature]
        Severity: Major
        Found in avaframe/in1Data/getInput.py and 1 other location - About 3 hrs to fix
        avaframe/in1Data/getInput.py on lines 834..836

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    xFeat = lineDict["x"][
                        int(lineDict["Start"][lineFeature]) : int(
                            lineDict["Start"][lineFeature] + lineDict["Length"][lineFeature]
        Severity: Major
        Found in avaframe/in1Data/getInput.py and 1 other location - About 3 hrs to fix
        avaframe/in1Data/getInput.py on lines 839..841

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    if len(infoParts) == 6: #this is the _C_M_ etc variant
                        dataDF.loc[simName, 'simModified'] = infoParts[1]
                        dataDF.loc[simName, 'simType'] = infoParts[3]
                        dataDF.loc[simName, 'modelType'] = infoParts[4]
        Severity: Major
        Found in avaframe/in3Utils/fileHandlerUtils.py and 1 other location - About 3 hrs to fix
        avaframe/in3Utils/fileHandlerUtils.py on lines 706..709

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 67.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language