crowbar/barclamp-hadoop

View on GitHub

Showing 7 of 22 total issues

Method create_proposal has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

  def create_proposal
    @logger.debug("hadoop create_proposal: entering")
    base = super
    
    # Compute the hadoop cluster node distribution.
Severity: Minor
Found in crowbar_framework/app/models/hadoop_service.rb - About 5 hrs 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 create_proposal has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_proposal
    @logger.debug("hadoop create_proposal: entering")
    base = super
    
    # Compute the hadoop cluster node distribution.
Severity: Minor
Found in crowbar_framework/app/models/hadoop_service.rb - About 1 hr to fix

Method apply_role_pre_chef_call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def apply_role_pre_chef_call(old_role, role, all_nodes)
    @logger.debug("hadoop apply_role_pre_chef_call: entering #{all_nodes.inspect}")
    return if all_nodes.empty? 
    
    # Make sure that the front-end pieces have public ip addreses.
Severity: Minor
Found in crowbar_framework/app/models/hadoop_service.rb - About 55 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

Avoid deeply nested control flow statements.
Open

      slaves << nodes[1][:fqdn] if nodes[1][:fqdn]        
Severity: Major
Found in crowbar_framework/app/models/hadoop_service.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        slaves << n[:fqdn] if n[:fqdn]
Severity: Major
Found in crowbar_framework/app/models/hadoop_service.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      master << nodes[0][:fqdn] if nodes[0][:fqdn]
Severity: Major
Found in crowbar_framework/app/models/hadoop_service.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      edge << nodes[2][:fqdn] if nodes[2][:fqdn]
Severity: Major
Found in crowbar_framework/app/models/hadoop_service.rb - About 45 mins to fix
Severity
Category
Status
Source
Language