avocado-framework/avocado

View on GitHub
avocado/utils/linux_modules.py

Summary

Maintainability
B
6 hrs
Test Coverage
F
31%

Function loaded_module_info has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

def loaded_module_info(module_name):
    """
    Get loaded module details: Size and Submodules.

    :param module_name: Name of module to search for
Severity: Minor
Found in avocado/utils/linux_modules.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 check_kernel_config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def check_kernel_config(config_name):
    """
    Reports the configuration of $config_name of the current kernel

    :param config_name: Name of kernel config to search
Severity: Minor
Found in avocado/utils/linux_modules.py - About 55 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

Avoid deeply nested control flow statements.
Open

                    if param_type is not None:
                        param_dic["type"] = param_type.group(1)
                    param_list.append(param_dic)
Severity: Major
Found in avocado/utils/linux_modules.py - About 45 mins to fix

    Function parse_lsmod_for_module has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_lsmod_for_module(l_raw, module_name, escape=True):
        """
        Use a regex to parse raw lsmod output and get module information
        :param l_raw: raw output of lsmod
        :type l_raw:  str
    Severity: Minor
    Found in avocado/utils/linux_modules.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

    Function unload_module has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def unload_module(module_name):
        """
        Removes a module. Handles dependencies. If even then it's not possible
        to remove one of the modules, it will throw an error.CmdError exception.
    
    
    Severity: Minor
    Found in avocado/utils/linux_modules.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