dmichael/amazon-mws

View on GitHub

Showing 5 of 16 total issues

Method request has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def request(verb, path, query_params, body = nil, attempts = 0, &block)
        # presumably this is for files
        body.rewind if body.respond_to?(:rewind) unless attempts.zero?
        # Prepare the Proc to be called by Net::HTTP
        proc = requester(verb, path, query_params, body)
Severity: Minor
Found in lib/amazon/mws/connection.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 request has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def request(verb, path, query_params = {}, body = nil, attempts = 0, &block)
Severity: Minor
Found in lib/amazon/mws/base.rb - About 45 mins to fix

    Method request has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def request(verb, path, query_params, body = nil, attempts = 0, &block)
    Severity: Minor
    Found in lib/amazon/mws/connection.rb - About 45 mins to fix

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

          def process_body(body)
            @request.content_length = 0 and return self if body.nil?
      
            if body.respond_to?(:read)                                                                
              @request.body_stream = body                                                           
      Severity: Minor
      Found in lib/amazon/mws/connection/request_builder.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 require_library_or_gem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def require_library_or_gem(library, gem_name = nil)
          if RUBY_VERSION >= '1.9'
            gem(gem_name || library, '>=0') 
          end
          require library
      Severity: Minor
      Found in lib/amazon/mws/lib/extensions.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