mhuggins/a2z

View on GitHub

Showing 8 of 17 total issues

Method from_response has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

      def self.from_response(data)
        new.tap do |browse_node|
          if data
            browse_node.id   = data['BrowseNodeId']
            browse_node.name = data['Name']
Severity: Minor
Found in lib/a2z/responses/browse_node.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 from_response has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def self.from_response(data)
        new.tap do |item|
          item.asin = data['ASIN']
          item.parent_asin = data['ParentASIN']
          item.detail_page_url = data['DetailPageURL']
Severity: Minor
Found in lib/a2z/responses/item.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 from_response has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.from_response(data)
        new.tap do |item|
          item.asin = data['ASIN']
          item.parent_asin = data['ParentASIN']
          item.detail_page_url = data['DetailPageURL']
Severity: Minor
Found in lib/a2z/responses/item.rb - About 1 hr to fix

    Method from_response has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.from_response(data)
            new.tap do |browse_node|
              if data
                browse_node.id   = data['BrowseNodeId']
                browse_node.name = data['Name']
    Severity: Minor
    Found in lib/a2z/responses/browse_node.rb - About 1 hr to fix

      Method from_response has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.from_response(data)
              new.tap do |offer|
                if (attributes = data['OfferAttributes'])
                  offer.condition = attributes['Condition']
                end
      Severity: Minor
      Found in lib/a2z/responses/offer.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 from_response has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.from_response(data)
              new.tap do |item_search|
                item_search.operation_request       = OperationRequest.from_response(data['OperationRequest']) if data['OperationRequest']
                item_search.items                   = items_from_response(data)
                item_search.total_results           = data['Items']['TotalResults'].to_i rescue 0
      Severity: Minor
      Found in lib/a2z/responses/item_search.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 from_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.from_response(data)
              new.tap do |item_lookup|
                item_lookup.operation_request = OperationRequest.from_response(data['OperationRequest']) if data['OperationRequest']
                item_lookup.item              = Item.from_response(data['Items']['Item']) if data['Items'] && data['Items']['Item']
                item_lookup.valid             = data['Items']['Request']['IsValid'] == 'True' rescue false
      Severity: Minor
      Found in lib/a2z/responses/item_lookup.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 from_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.from_response(data)
              new.tap do |operation_request|
                operation_request.request_id = data['RequestId']
                operation_request.request_processing_time = data['RequestProcessingTime'].to_f
                
      Severity: Minor
      Found in lib/a2z/responses/operation_request.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