avocado-framework/avocado

View on GitHub
avocado/utils/data_structures.py

Summary

Maintainability
C
1 day
Test Coverage
B
89%

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

def compare_matrices(matrix1, matrix2, threshold=0.05):
    """
    Compare 2 matrices nxm and return a matrix nxm with comparison data and
    stats. When the first columns match, they are considered as header and
    included in the results intact.
Severity: Minor
Found in avocado/utils/data_structures.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 data_structures.py has 298 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
Severity: Minor
Found in avocado/utils/data_structures.py - About 3 hrs to fix

    Function recursive_compare_dict has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def recursive_compare_dict(dict1, dict2, level="DictKey", diff_btw_dict=None):
        """
        Difference between two dictionaries are returned
        Dict values can be a dictionary, list and value
    
    
    Severity: Minor
    Found in avocado/utils/data_structures.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 time_to_seconds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def time_to_seconds(time):
        """
        Convert time in minutes, hours and days to seconds.
        :param time: Time, optionally including the unit (i.e. '10d')
        """
    Severity: Minor
    Found in avocado/utils/data_structures.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