QualiSystems/vCenterShell

View on GitHub
package/cloudshell/cp/vcenter/vm/vnic_to_network_mapper.py

Summary

Maintainability
A
3 hrs
Test Coverage

Function map_request_to_vnics has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def map_request_to_vnics(self, requests, vnics, existing_network, default_network, reserved_networks):
        """
        gets the requests for connecting netwoks and maps it the suitable vnic of specific is not specified
        :param reserved_networks: array of reserved networks
        :param requests:
Severity: Minor
Found in package/cloudshell/cp/vcenter/vm/vnic_to_network_mapper.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 _map_vnic_to_network has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def _map_vnic_to_network(self, vnics, existing_network, default_network, reserved_networks):
        mapping = dict()
        for vnic_name, vnic in vnics.items():
            network_to_map = ''
            if hasattr(vnic, 'backing'):
Severity: Minor
Found in package/cloudshell/cp/vcenter/vm/vnic_to_network_mapper.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 map_request_to_vnics has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def map_request_to_vnics(self, requests, vnics, existing_network, default_network, reserved_networks):
Severity: Minor
Found in package/cloudshell/cp/vcenter/vm/vnic_to_network_mapper.py - About 35 mins to fix

    There are no issues that match your filters.

    Category
    Status