18F/hash-joiner

View on GitHub

Showing 5 of 5 total issues

Method assert_hash_properties_are_mergeable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.assert_hash_properties_are_mergeable(key, lhs_value, rhs_value)
    lhs_class = lhs_value == false ? ::TrueClass : lhs_value.class
    rhs_class = rhs_value == false ? ::TrueClass : rhs_value.class

    unless lhs_value.nil? or lhs_class == rhs_class
Severity: Minor
Found in lib/hash-joiner.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

Method prune_empty_properties_helper has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.prune_empty_properties_helper(collection, seen_before)
    return collection if seen_before[collection.object_id]
    seen_before[collection.object_id] = true
    if collection.instance_of? ::Hash
      collection.each_value {|i| prune_empty_properties_helper i, seen_before}
Severity: Minor
Found in lib/hash-joiner.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

Method join_array_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.join_array_data(key_field, lhs, rhs)
    unless lhs.instance_of? ::Array and rhs.instance_of? ::Array
      raise JoinError.new("Both lhs (#{lhs.class}) and " +
        "rhs (#{rhs.class}) must be an Array of Hash")
    end
Severity: Minor
Found in lib/hash-joiner.rb - About 25 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 join_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.join_data(category, key_field, lhs, rhs)
    rhs_data = rhs[category]
    return lhs unless rhs_data

    lhs_data = lhs[category]
Severity: Minor
Found in lib/hash-joiner.rb - About 25 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 assign_empty_defaults has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.assign_empty_defaults(collection, array_properties, hash_properties,
    string_properties)
    if collection.instance_of? ::Hash
      array_properties.each {|i| collection[i] ||= Array.new}
      hash_properties.each {|i| collection[i] ||= Hash.new}
Severity: Minor
Found in lib/hash-joiner.rb - About 25 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

Severity
Category
Status
Source
Language