rorkjop/klarna-checkout-ruby

View on GitHub
lib/klarna/checkout/client.rb

Summary

Maintainability
A
0 mins
Test Coverage

Cyclomatic complexity for handle_status_code is too high. [11/6]
Open

      def handle_status_code(code, msg = nil)
        case Integer(code)
          when 200, 201
            yield if block_given?
          when 400
Severity: Minor
Found in lib/klarna/checkout/client.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method Klarna::Checkout::Client#environment is defined at both lib/klarna/checkout/client.rb:10 and lib/klarna/checkout/client.rb:21.
Open

      def environment
Severity: Minor
Found in lib/klarna/checkout/client.rb by rubocop

This cop checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def duplicated
  1
end

def duplicated
  2
end

Example:

# bad

def duplicated
  1
end

alias duplicated other_duplicated

Example:

# good

def duplicated
  1
end

def other_duplicated
  2
end

Method Klarna::Checkout::Client#environment= is defined at both lib/klarna/checkout/client.rb:10 and lib/klarna/checkout/client.rb:25.
Open

      def environment=(new_env)
Severity: Minor
Found in lib/klarna/checkout/client.rb by rubocop

This cop checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def duplicated
  1
end

def duplicated
  2
end

Example:

# bad

def duplicated
  1
end

alias duplicated other_duplicated

Example:

# good

def duplicated
  1
end

def other_duplicated
  2
end

There are no issues that match your filters.

Category
Status