activemerchant/active_merchant

View on GitHub
lib/active_merchant/billing/gateways/paypal.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method add_three_d_secure has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def add_three_d_secure(xml, options)
        three_d_secure = options[:three_d_secure]
        xml.tag! 'ThreeDSecureRequest' do
          xml.tag! 'MpiVendor3ds', 'Y'
          xml.tag! 'AuthStatus3ds', three_d_secure[:authentication_response_status] || three_d_secure[:trans_status] if three_d_secure[:authentication_response_status] || three_d_secure[:trans_status]
Severity: Minor
Found in lib/active_merchant/billing/gateways/paypal.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 build_sale_or_authorization_request has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def build_sale_or_authorization_request(action, money, credit_card_or_referenced_id, options)
        transaction_type = define_transaction_type(credit_card_or_referenced_id)
        reference_id = credit_card_or_referenced_id if transaction_type == 'DoReferenceTransaction'

        billing_address = options[:billing_address] || options[:address]
Severity: Minor
Found in lib/active_merchant/billing/gateways/paypal.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

There are no issues that match your filters.

Category
Status