KarrLab/wc_sim

View on GitHub
wc_sim/testing/analyze_tolerances.py

Summary

Maintainability
C
1 day
Test Coverage

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

def analyze(file):  # pragma: no cover
    atols = set()
    rtols = set()
    cases = set()
    data = {}
Severity: Minor
Found in wc_sim/testing/analyze_tolerances.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 heatmap has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

def heatmap(data, row_labels, col_labels, ax=None, size=None,
Severity: Major
Found in wc_sim/testing/analyze_tolerances.py - About 1 hr to fix

    Function plot has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def plot(): # pragma: no cover
        file = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', 'tests', 'testing',
                            'verification_results', 'ode_tuning', FILE)
        pathname = os.path.normpath(file)
        num_cases, fraction_solved_df, compute_time_df, failures_rate_df = analyze(pathname)
    Severity: Minor
    Found in wc_sim/testing/analyze_tolerances.py - About 1 hr to fix

      Function annotate_heatmap has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def annotate_heatmap(im, data=None, valfmt="{x:.2f}",
      Severity: Minor
      Found in wc_sim/testing/analyze_tolerances.py - About 45 mins to fix

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

        def annotate_heatmap(im, data=None, valfmt="{x:.2f}",
                             textcolors=["black", "white"],
                             threshold=None, **textkw): # pragma: no cover
            """
            A function to annotate a heatmap.
        Severity: Minor
        Found in wc_sim/testing/analyze_tolerances.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 heatmap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def heatmap(data, row_labels, col_labels, ax=None, size=None,
                    cbar_kw={}, cbarlabel="", xlabel=None, ylabel=None, title=None, **kwargs):  # pragma: no cover
            """
            Create a heatmap from a numpy array and two lists of labels.
        
        
        Severity: Minor
        Found in wc_sim/testing/analyze_tolerances.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