saltstack/salt

View on GitHub
salt/utils/virtualbox.py

Summary

Maintainability
D
1 day
Test Coverage

File virtualbox.py has 561 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Utilities to help make requests to virtualbox

The virtualbox SDK reference can be found at http://download.virtualbox.org/virtualbox/SDKRef.pdf
Severity: Major
Found in salt/utils/virtualbox.py - About 1 day to fix

    Function vb_get_network_addresses has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def vb_get_network_addresses(machine_name=None, machine=None, wait_for_pattern=None):
        '''
        TODO distinguish between private and public addresses
    
        A valid machine_name or a machine is needed to make this work!
    Severity: Minor
    Found in salt/utils/virtualbox.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 vb_xpcom_to_attribute_dict has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def vb_xpcom_to_attribute_dict(xpcom,
                                   interface_name=None,
                                   attributes=None,
                                   excluded_attributes=None,
                                   extra_attributes=None
    Severity: Minor
    Found in salt/utils/virtualbox.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 vb_machine_exists has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def vb_machine_exists(name):
        '''
        Checks in with the hypervisor to see if the machine with the given name is known
        @param name:
        @type name:
    Severity: Minor
    Found in salt/utils/virtualbox.py - About 45 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