crowbar_framework/app/models/ceilometer_service.rb
Method role_constraints
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def role_constraints
{
"ceilometer-agent" => {
"unique" => false,
"count" => -1,
- Create a ticketCreate a ticket
Method create_proposal
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_proposal
@logger.debug("Ceilometer create_proposal: entering")
base = super
base["attributes"][@bc_name]["database_instance"] = find_dep_proposal("database", true)
- Create a ticketCreate a ticket
Method validate_proposal_after_save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def validate_proposal_after_save(proposal)
validate_one_for_role proposal, "ceilometer-central"
validate_one_for_role proposal, "ceilometer-server"
# unless (proposal["deployment"]["ceilometer"]["elements"]["ceilometer-agent-hyperv"] || []).empty? || hyperv_available?
- 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 apply_role_pre_chef_call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def apply_role_pre_chef_call(old_role, role, all_nodes)
@logger.debug("Ceilometer apply_role_pre_chef_call: entering #{all_nodes.inspect}")
return if all_nodes.empty?
unless hyperv_available?
- 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"