Showing 722 of 1,271 total issues
Method select_nic
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def select_nic(fog_nics, nic)
nic_attrs = nic.compute_attributes
all_networks = service.list_networks(datacenter: datacenter)
vm_network = all_networks.detect { |network| nic_attrs['network'] && [network[:name], network[:id]].compact.include?(nic_attrs['network']) }
vm_network ||= all_networks.detect { |network| network[:_ref] == nic_attrs['network'] }
- Read upRead up
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
Method sequence_hostgroup_param_next
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def sequence_hostgroup_param_next(hostgroup_name, increment = 1, name = "default", prefix = 1)
# This helper cannot be in a host-context because it was built mainly for discovery naming
# where host-hostgroup was not yet set. This macro allows accessing hostgroup parameters
# named starting with "sequence_num_" and increasing those counters which is not a security
# threat.
- Read upRead up
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"