Class PacemakerServiceObject
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class PacemakerServiceObject < ServiceObject
#
# Eigenclass with methods used by ServiceObject
#
- Create a ticketCreate a ticket
Method prepare_role_for_cluster_vip_networks
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def prepare_role_for_cluster_vip_networks(role, elements, networks)
dirty = false
elements.each do |element|
next unless PacemakerServiceObject.is_cluster?(element)
- Read upRead up
- Create a ticketCreate a ticket
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 allocate_virtual_ips_for_cluster_in_networks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def allocate_virtual_ips_for_cluster_in_networks(cluster, networks)
if networks.nil? || networks.empty? || !PacemakerServiceObject.is_cluster?(cluster)
[false, false]
else
nodes = PacemakerServiceObject.expand_nodes(cluster)
- Read upRead up
- Create a ticketCreate a ticket
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 prepare_role_for_ha_with_haproxy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def prepare_role_for_ha_with_haproxy(role, attribute_path, ha_enabled, elements, networks)
- Create a ticketCreate a ticket
Method role_expand_elements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def role_expand_elements(role, role_name)
elements = role.override_attributes[@bc_name]["elements"][role_name]
expanded_nodes = nil
if role.override_attributes[@bc_name].key?("elements_expanded")
expanded_nodes = role.override_attributes[@bc_name]["elements_expanded"][role_name]
- Read upRead up
- Create a ticketCreate a ticket
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"