Shopify/active_merchant

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

Summary

Maintainability
D
2 days
Test Coverage

Class CyberSourceRestGateway has 48 methods (exceeds 20 allowed). Consider refactoring.
Open

    class CyberSourceRestGateway < Gateway
      include ActiveMerchant::Billing::CyberSourceCommon

      self.test_url = 'https://apitest.cybersource.com'
      self.live_url = 'https://api.cybersource.com'
Severity: Minor
Found in lib/active_merchant/billing/gateways/cyber_source_rest.rb - About 6 hrs to fix

    File cyber_source_rest.rb has 400 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'active_merchant/billing/gateways/cyber_source/cyber_source_common'
    
    module ActiveMerchant #:nodoc:
      module Billing #:nodoc:
        class CyberSourceRestGateway < Gateway
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/cyber_source_rest.rb - About 5 hrs to fix

      Method add_three_ds has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_three_ds(post, payment_method, options)
              return unless three_d_secure = options[:three_d_secure]
      
              post[:consumerAuthenticationInformation] ||= {}
              if payment_method.brand == 'master'
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/cyber_source_rest.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 add_network_tokenization_card has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_network_tokenization_card(post, payment, options)
              post[:processingInformation][:commerceIndicator] = 'internet' unless options[:stored_credential] || card_brand(payment) == 'jcb'
      
              post[:paymentInformation][:tokenizedCard] = {
                number: payment.number,
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/cyber_source_rest.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 add_address has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def add_address(post, payment_method, address, options, address_type)
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/cyber_source_rest.rb - About 35 mins to fix

        Method add_merchant_description has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_merchant_description(post, options)
                return unless options[:merchant_descriptor_name] || options[:merchant_descriptor_address1] || options[:merchant_descriptor_locality]
        
                merchant = post[:merchantInformation][:merchantDescriptor] = {}
                merchant[:name] = options[:merchant_descriptor_name] if options[:merchant_descriptor_name]
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/cyber_source_rest.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

        There are no issues that match your filters.

        Category
        Status