jasonroelofs/simple_aws

View on GitHub

Showing 6 of 8 total issues

Method build_request has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def build_request(method, path, options = {})
      if options[:bucket]
        path = "/#{options[:bucket]}/#{path}".gsub("//", "/")
      end

Severity: Minor
Found in lib/simple_aws/s3.rb - About 1 hr to fix

    Method build_request has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_request(method, path, options = {})
          if options[:bucket]
            path = "/#{options[:bucket]}/#{path}".gsub("//", "/")
          end
    
    
    Severity: Minor
    Found in lib/simple_aws/s3.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 parse_error_from has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_error_from(body)
          if body.has_key? "ErrorResponse"
            body["ErrorResponse"]["Error"]
          elsif body.has_key? "Error"
            if body["Error"]["StringToSign"]
    Severity: Minor
    Found in lib/simple_aws/core/response.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 call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def call(method, path, options = {})
          request = SimpleAWS::Request.new method, self.uri, "/#{self.version}#{path}"
    
          (options[:params] || {}).each do |k, v|
            request.params[k] = v
    Severity: Minor
    Found in lib/simple_aws/cloud_front.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(http_response)
          if !http_response.success?
            parse_and_throw_error_from http_response
          end
    
    
    Severity: Minor
    Found in lib/simple_aws/core/response.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 setup_raw_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def setup_raw_request
          @raw_request = http_method.new(uri.request_uri)
          if body
            if body.respond_to?(:read)
              @raw_request.body_stream = body
    Severity: Minor
    Found in lib/simple_aws/core/connection.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