Shopify/active_merchant

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

Summary

Maintainability
F
1 wk
Test Coverage

Method build_recurring_request has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring.
Open

      def build_recurring_request(action, money, options)
        raise StandardError, "Invalid Recurring Profile Action: #{action}" unless RECURRING_ACTIONS.include?(action)

        xml = Builder::XmlMarkup.new
        xml.tag! 'RecurringProfiles' do
Severity: Minor
Found in lib/active_merchant/billing/gateways/payflow.rb - About 2 days 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_credit_card_request has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
Open

      def build_credit_card_request(action, money, credit_card, options)
        xml = Builder::XmlMarkup.new
        xml.tag! TRANSACTIONS[action] do
          xml.tag! 'PayData' do
            xml.tag! 'Invoice' do
Severity: Minor
Found in lib/active_merchant/billing/gateways/payflow.rb - About 1 day 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_reference_sale_or_authorization_request has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

      def build_reference_sale_or_authorization_request(action, money, reference, options)
        xml = Builder::XmlMarkup.new
        xml.tag! TRANSACTIONS[action] do
          xml.tag! 'PayData' do
            xml.tag! 'Invoice' do
Severity: Minor
Found in lib/active_merchant/billing/gateways/payflow.rb - About 1 day 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_check_request has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

      def build_check_request(action, money, check, options)
        xml = Builder::XmlMarkup.new
        xml.tag! TRANSACTIONS[action] do
          xml.tag! 'PayData' do
            xml.tag! 'Invoice' do
Severity: Minor
Found in lib/active_merchant/billing/gateways/payflow.rb - About 5 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

File payflow.rb has 384 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'nokogiri'
require 'active_merchant/billing/gateways/payflow/payflow_common_api'
require 'active_merchant/billing/gateways/payflow/payflow_response'
require 'active_merchant/billing/gateways/payflow_express'

Severity: Minor
Found in lib/active_merchant/billing/gateways/payflow.rb - About 5 hrs to fix

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

          def add_three_d_secure(options, xml)
            if options[:three_d_secure]
              three_d_secure = options[:three_d_secure]
              xml.tag! 'BuyerAuthResult' do
                authentication_status(three_d_secure, xml)
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/payflow.rb - About 4 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

    Class PayflowGateway has 37 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class PayflowGateway < Gateway
          include PayflowCommonAPI
    
          RECURRING_ACTIONS = Set.new(%i[add modify cancel inquiry reactivate payment])
    
    
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/payflow.rb - About 4 hrs to fix

      Method add_mpi_3ds has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_mpi_3ds(xml, three_d_secure_options)
              # structure as per https://developer.paypal.com/api/nvp-soap/payflow/3d-secure-mpi/
              authentication_id = three_d_secure_options[:authentication_id]
              authentication_status = three_d_secure_options[:authentication_response_status]
      
      
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/payflow.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 build_recurring_request has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def build_recurring_request(action, money, options)
              raise StandardError, "Invalid Recurring Profile Action: #{action}" unless RECURRING_ACTIONS.include?(action)
      
              xml = Builder::XmlMarkup.new
              xml.tag! 'RecurringProfiles' do
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/payflow.rb - About 1 hr to fix

        Method build_credit_card_request has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def build_credit_card_request(action, money, credit_card, options)
                xml = Builder::XmlMarkup.new
                xml.tag! TRANSACTIONS[action] do
                  xml.tag! 'PayData' do
                    xml.tag! 'Invoice' do
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/payflow.rb - About 1 hr to fix

          Method build_reference_sale_or_authorization_request has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def build_reference_sale_or_authorization_request(action, money, reference, options)
                  xml = Builder::XmlMarkup.new
                  xml.tag! TRANSACTIONS[action] do
                    xml.tag! 'PayData' do
                      xml.tag! 'Invoice' do
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/payflow.rb - About 1 hr to fix

            Method build_check_request has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def build_check_request(action, money, check, options)
                    xml = Builder::XmlMarkup.new
                    xml.tag! TRANSACTIONS[action] do
                      xml.tag! 'PayData' do
                        xml.tag! 'Invoice' do
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/payflow.rb - About 1 hr to fix

              Method recurring has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def recurring(money, credit_card, options = {})
                      ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
              
                      options[:name] = credit_card.name if options[:name].blank? && credit_card
                      request = build_recurring_request(options[:profile_id] ? :modify : :add, money, options) do |xml|
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/payflow.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