Showing 6 of 8 total issues

Method handle_type has 149 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def handle_type(data, type)
      Response.create(data).tap do |schash|
        schash.instance_eval do
          case type
          when :cart
Severity: Major
Found in lib/asin/adapter.rb - About 5 hrs to fix

    Method children has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

                def children
                  return [] unless children
                  children.browse_node.is_a?(Array) ? children.browse_node : [children.browse_node]
                end
    Severity: Minor
    Found in lib/asin/adapter.rb - About 1 hr 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 top_item_set has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

                def top_item_set
                  return [] unless top_item_set
                  top_item_set.top_item.is_a?(Array) ? top_item_set.top_item : [top_item_set.top_item]
                end
    Severity: Minor
    Found in lib/asin/adapter.rb - About 1 hr 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 ancestors has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

                def ancestors
                  return [] unless ancestors
                  ancestors.browse_node.is_a?(Array) ? ancestors.browse_node : [ancestors.browse_node]
                end
    Severity: Minor
    Found in lib/asin/adapter.rb - About 1 hr 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 items has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

                def items
                  return [] unless cart_items
                  cart_items.cart_item.is_a?(Array) ? cart_items.cart_item : [cart_items.cart_item]
                end
    Severity: Minor
    Found in lib/asin/adapter.rb - About 1 hr 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 saved_items has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

                def saved_items
                  return [] unless saved_for_later_items
                  saved_for_later_items.saved_for_later_item.is_a?(Array) ? saved_for_later_items.saved_for_later_item : [saved_for_later_items.saved_for_later_item]
                end
    Severity: Minor
    Found in lib/asin/adapter.rb - About 1 hr 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