tylerhunt/remit

View on GitHub

Showing 6 of 12 total issues

Method validate_signature_v2 has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_signature_v2(args)
      [:parameters,
     :http_method,
     :url_end_point].each do |arg|
      raise "#{arg.inspect} is missing from the arguments." unless args[arg]
Severity: Minor
Found in lib/amazon/fps/signatureutilsforoutbound.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 validate_signature_v2 has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def validate_signature_v2(args)
      [:parameters,
     :http_method,
     :url_end_point].each do |arg|
      raise "#{arg.inspect} is missing from the arguments." unless args[arg]
Severity: Minor
Found in lib/amazon/fps/signatureutilsforoutbound.rb - About 1 hr to fix

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

        def initialize(request_url, params, client, options = {})
          if params.is_a?(String)
            @string_params = params
            @hash_params = Hash.from_url_params(params)
          else
    Severity: Minor
    Found in lib/remit/inbound_request.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 calculate_string_to_sign_v2 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.calculate_string_to_sign_v2(args)
        parameters = args[:parameters]
    
        uri = args[:uri]
        uri = "/" if uri.nil? or uri.empty?
    Severity: Minor
    Found in lib/amazon/fps/signatureutils.rb - About 45 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 valid? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def valid?
          if @hash_params['signatureVersion'].to_i == 2
            #puts "\nhash_params: #{@hash_params.inspect}\n"
            #puts "\nstring_params: #{@string_params.inspect}\n"
            return false unless InboundRequest.check_parameters(@hash_params)
    Severity: Minor
    Found in lib/remit/inbound_request.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 check_parameters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_parameters(params)
    #      begin
            raise ":parameters must be enumerable" unless params.kind_of? Enumerable
    
            signature = params[SIGNATURE_KEYNAME];
    Severity: Minor
    Found in lib/remit/signature_utils_for_outbound.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