hopsoft/footing

View on GitHub

Showing 4 of 4 total issues

Method filter! has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def filter!(keys, replacement: "[FILTERED]")
      should_replace = lambda do |key|
        replace = false
        keys.each do |k|
          break if replace
Severity: Minor
Found in lib/footing/hash.rb - About 2 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 to_h has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def to_h
      copied_object.each_with_object({}) do |pair, memo|
        value = pair.last
        if value.is_a?(Footing::Hash)
          memo[pair.first] = value.to_h
Severity: Minor
Found in lib/footing/hash.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

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

    def update_keys!(&block)
      @copied_object = copied_object.each_with_object({}) do |pair, memo|
        key = pair.first
        new_key = block.call(key)
        value = pair.last
Severity: Minor
Found in lib/footing/hash.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

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

    def initialize_nested
      copied_object.each do |key, value|
        if value.is_a? ::Hash
          copied_object[key] = Footing::Hash.new(value)
        elsif value.is_a? ::Array
Severity: Minor
Found in lib/footing/hash.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

Severity
Category
Status
Source
Language