sealink/ruby_core_extensions

View on GitHub

Showing 4 of 6 total issues

Method recursive_blank? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

   def recursive_blank?
     each do |v|
       if v.respond_to?(:recursive_blank?)
         return false unless v.recursive_blank?
       else
Severity: Minor
Found in lib/ruby_core_extensions/recursive/array.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 recursive_blank? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def recursive_blank?
    each do |k, v|
      if v.respond_to?(:recursive_blank?)
        return false unless v.recursive_blank?
      else
Severity: Minor
Found in lib/ruby_core_extensions/recursive/hash.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 hash_by has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def hash_by(key = nil, method = nil, &block)
    self.inject({}) do |h, element|
      if key
        h[element.send(key)] = if block_given?
          yield(element)
Severity: Minor
Found in lib/ruby_core_extensions/array.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 squash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def squash(limit)
    return self if size <= limit

    words = split(' ')

Severity: Minor
Found in lib/ruby_core_extensions/string.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

Severity
Category
Status
Source
Language