activemerchant/active_merchant

View on GitHub

Showing 977 of 1,450 total issues

Method build_setup_request has a Cognitive Complexity of 128 (exceeds 5 allowed). Consider refactoring.
Open

      def build_setup_request(action, money, options)
        currency_code = options[:currency] || currency(money)
        options[:payment_action] = action
        options[:express_request] = true
        options[:shipping_address] ||= options[:address]
Severity: Minor
Found in lib/active_merchant/billing/gateways/paypal_express.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

File authorize_net.rb has 984 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'nokogiri'

module ActiveMerchant
  module Billing
    class AuthorizeNetGateway < Gateway
Severity: Major
Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 2 days to fix

    File cyber_source.rb has 977 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module ActiveMerchant #:nodoc:
      module Billing #:nodoc:
        # Initial setup instructions can be found in
        # http://apps.cybersource.com/library/documentation/dev_guides/SOAP_Toolkits/SOAP_toolkits.pdf
        #
    Severity: Major
    Found in lib/active_merchant/billing/gateways/cyber_source.rb - About 2 days to fix

      File orbital.rb has 933 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'active_merchant/billing/gateways/orbital/orbital_soft_descriptors'
      require 'rexml/document'
      
      module ActiveMerchant #:nodoc:
        module Billing #:nodoc:
      Severity: Major
      Found in lib/active_merchant/billing/gateways/orbital.rb - About 2 days to fix

        File braintree_blue.rb has 927 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'active_merchant/billing/gateways/braintree/braintree_common'
        require 'active_merchant/billing/gateways/braintree/token_nonce'
        require 'active_support/core_ext/array/extract_options'
        
        begin
        Severity: Major
        Found in lib/active_merchant/billing/gateways/braintree_blue.rb - About 2 days to fix

          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

          File worldpay.rb has 868 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'nokogiri'
          
          module ActiveMerchant #:nodoc:
            module Billing #:nodoc:
              class WorldpayGateway < Gateway
          Severity: Major
          Found in lib/active_merchant/billing/gateways/worldpay.rb - About 2 days to fix

            File usa_epay_advanced.rb has 842 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'securerandom'
            require 'digest'
            
            module ActiveMerchant #:nodoc:
              module Billing #:nodoc:
            Severity: Major
            Found in lib/active_merchant/billing/gateways/usa_epay_advanced.rb - About 2 days to fix

              Class CyberSourceGateway has 102 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class CyberSourceGateway < Gateway
                    self.test_url = 'https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor'
                    self.live_url = 'https://ics2wsa.ic3.com/commerce/1.x/transactionProcessor'
              
                    # Schema files can be found here: https://ics2ws.ic3.com/commerce/1.x/transactionProcessor/
              Severity: Major
              Found in lib/active_merchant/billing/gateways/cyber_source.rb - About 1 day to fix

                Class WorldpayGateway has 100 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class WorldpayGateway < Gateway
                      self.test_url = 'https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp'
                      self.live_url = 'https://secure.worldpay.com/jsp/merchant/xml/paymentService.jsp'
                
                      self.default_currency = 'GBP'
                Severity: Major
                Found in lib/active_merchant/billing/gateways/worldpay.rb - About 1 day to fix

                  File adyen.rb has 804 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module ActiveMerchant #:nodoc:
                    module Billing #:nodoc:
                      class AdyenGateway < Gateway
                        # we recommend setting up merchant-specific endpoints.
                        # https://docs.adyen.com/developers/api-manual#apiendpoints
                  Severity: Major
                  Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 day to fix

                    Class OrbitalGateway has 96 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class OrbitalGateway < Gateway
                          include Empty
                    
                          API_VERSION = '9.0'
                    
                    
                    Severity: Major
                    Found in lib/active_merchant/billing/gateways/orbital.rb - About 1 day to fix

                      Method build_create_profile_request has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def build_create_profile_request(options)
                              xml = Builder::XmlMarkup.new :indent => 2
                              xml.tag! 'CreateRecurringPaymentsProfileReq', 'xmlns' => PAYPAL_NAMESPACE do
                                xml.tag! 'CreateRecurringPaymentsProfileRequest', 'xmlns:n2' => EBAY_NAMESPACE do
                                  xml.tag! 'n2:Version', API_VERSION
                      Severity: Minor
                      Found in lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.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

                      Class UsaEpayAdvancedGateway has 90 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class UsaEpayAdvancedGateway < Gateway
                            API_VERSION = '1.4'
                      
                            TEST_URL_BASE = 'https://sandbox.usaepay.com/soap/gate/' #:nodoc:
                            LIVE_URL_BASE = 'https://www.usaepay.com/soap/gate/' #:nodoc:
                      Severity: Major
                      Found in lib/active_merchant/billing/gateways/usa_epay_advanced.rb - About 1 day to fix

                        File stripe.rb has 716 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'active_support/core_ext/hash/slice'
                        
                        module ActiveMerchant #:nodoc:
                          module Billing #:nodoc:
                            # This gateway uses an older version of the Stripe API.
                        Severity: Major
                        Found in lib/active_merchant/billing/gateways/stripe.rb - About 1 day to fix

                          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

                          Class AuthorizeNetGateway has 79 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class AuthorizeNetGateway < Gateway
                                include Empty
                          
                                self.test_url = 'https://apitest.authorize.net/xml/v1/request.api'
                                self.live_url = 'https://api2.authorize.net/xml/v1/request.api'
                          Severity: Major
                          Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 1 day to fix

                            Class AdyenGateway has 76 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                                class AdyenGateway < Gateway
                                  # we recommend setting up merchant-specific endpoints.
                                  # https://docs.adyen.com/developers/api-manual#apiendpoints
                                  self.test_url = 'https://pal-test.adyen.com/pal/servlet/'
                                  self.live_url = 'https://pal-live.adyen.com/pal/servlet/'
                            Severity: Major
                            Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 day to fix

                              Method add_contact has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def add_contact(doc, fullname, options)
                                      doc['v1'].contact do
                                        doc['v1'].fullName fullname unless fullname.blank?
                                        doc['v1'].coName options[:company_name] if options[:company_name]
                                        doc['v1'].title options[:title] if options[:title]

                              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_lodging has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def add_lodging(xml, options)
                                      if lodging = options[:lodging]
                                        xml.extendedParameters do
                                          xml.ExtendedParameters do
                                            xml.Key 'Lodging'
                              Severity: Minor
                              Found in lib/active_merchant/billing/gateways/element.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

                              Severity
                              Category
                              Status
                              Source
                              Language