crowbar/crowbar-openstack

View on GitHub
crowbar_framework/app/models/ceilometer_service.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method role_constraints has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def role_constraints
      {
        "ceilometer-agent" => {
          "unique" => false,
          "count" => -1,
Severity: Minor
Found in crowbar_framework/app/models/ceilometer_service.rb - About 1 hr to fix

Method create_proposal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_proposal
    @logger.debug("Ceilometer create_proposal: entering")
    base = super

    base["attributes"][@bc_name]["database_instance"] = find_dep_proposal("database", true)
Severity: Minor
Found in crowbar_framework/app/models/ceilometer_service.rb - About 1 hr to fix

Method validate_proposal_after_save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
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?
Severity: Minor
Found in crowbar_framework/app/models/ceilometer_service.rb - 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

Method apply_role_pre_chef_call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
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?
Severity: Minor
Found in crowbar_framework/app/models/ceilometer_service.rb - About 35 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