Shopify/active_merchant

View on GitHub

Showing 1,228 of 1,228 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 964 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 orbital.rb has 890 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

      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 usa_epay_advanced.rb has 841 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

        File cyber_source.rb has 841 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

          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 CyberSourceGateway has 92 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 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 worldpay.rb has 709 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 1 day to fix

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

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

                  File stripe.rb has 672 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

                    Class WorldpayGateway has 79 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

                      Method build_credit_card_request has a Cognitive Complexity of 72 (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 OrbitalGateway has 76 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class OrbitalGateway < Gateway
                            include Empty
                      
                            API_VERSION = '8.1'
                      
                      
                      Severity: Major
                      Found in lib/active_merchant/billing/gateways/orbital.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

                        Class AuthorizeNetGateway has 75 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

                          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

                          File adyen.rb has 607 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 StripeGateway has 69 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                                class StripeGateway < Gateway
                                  self.live_url = 'https://api.stripe.com/v1/'
                            
                                  AVS_CODE_TRANSLATOR = {
                                    'line1: pass, zip: pass' => 'Y',
                            Severity: Major
                            Found in lib/active_merchant/billing/gateways/stripe.rb - About 1 day to fix
                              Severity
                              Category
                              Status
                              Source
                              Language