avaframe/AvaFrame

View on GitHub
avaframe/in3Utils/cfgHandling.py

Summary

Maintainability
D
2 days
Test Coverage
B
87%

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

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

    def filterSims(avalancheDir, parametersDict, specDir="", simDF=""):
        """Filter simulations using a list of parameters and a pandas dataFrame of simulation configurations
        if ~ is used as a prefix for a parameter - it is filtered according to values that do NOT match the value
        provided with the ~Parameter
    
    
    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 removeSimsNotMatching has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def removeSimsNotMatching(simDF, key, value):
        """remove simulations from simDF that do not match filtering critera
    
        Parameters
        -----------
    Severity: Minor
    Found in avaframe/in3Utils/cfgHandling.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 filterCom1DFAThicknessValues has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def filterCom1DFAThicknessValues(key, value, simDF):
        """thickness settings different if read from shpfile - requires more complex filtering
        if read from shp - thickness values are provided per feature!!
        for example relTh = '' but relTh0 = 1 is appended for feature with id 0, relTh1 for feature
        with id 1, etc.
    Severity: Minor
    Found in avaframe/in3Utils/cfgHandling.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 rewriteLocalCfgs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def rewriteLocalCfgs(cfgFull, avalancheDir, localCfgPath=''):
        """fetch all override sections in cfgFull and write a local_NAMEOVERRIDE.ini configuration file for the
        available sections - naming is collection_module_override
        if no localCfgPath is provided, default saved to avalancheDir/Inputs/configurationOverrides
        where package refers to e.g. ana1Tests, ana3AIMEC, etc-
    Severity: Minor
    Found in avaframe/in3Utils/cfgHandling.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 _removeCfgItemsNotInOverride has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def _removeCfgItemsNotInOverride(cfgModule, overrideKeys):
        """ remove options of cfgModule if not part of overrideKeys
            in order to just have override parameters in new local cfg ini file
    
            Parameters
    Severity: Minor
    Found in avaframe/in3Utils/cfgHandling.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