core/app/models/spree/payment/processing.rb

Summary

Maintainability
A
2 hrs
Test Coverage
A
97%

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

      def handle_payment_preconditions
        unless block_given?
          raise ArgumentError, 'handle_payment_preconditions must be called with a block'
        end

Severity: Minor
Found in core/app/models/spree/payment/processing.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 handle_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def handle_response(response, success_state, failure_state)
        record_response(response)

        if response.success?
          unless response.authorization.nil?
Severity: Minor
Found in core/app/models/spree/payment/processing.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 void_transaction! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def void_transaction!
        return true if void?

        protect_from_connection_error do
          if payment_method.payment_profiles_supported?
Severity: Minor
Found in core/app/models/spree/payment/processing.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

There are no issues that match your filters.

Category
Status