activemerchant/active_merchant

View on GitHub

Showing 984 of 1,463 total issues

Method authorize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def authorize(money, payment_or_customer_id, options = {})
        post = {}
        add_amount(post, money, options)
        if customer_id?(payment_or_customer_id)
          post[:customer_id] = payment_or_customer_id
Severity: Minor
Found in lib/active_merchant/billing/gateways/pay_trace.rb - About 45 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

Method commit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(action, money, options)
        request = build_request(action, money, options)

        headers = { 'Content-Type' => 'text/xml',
                    'Authorization' => encoded_credentials }
Severity: Minor
Found in lib/active_merchant/billing/gateways/wirecard.rb - About 45 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

Method add_card_on_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_card_on_file(post, options)
        return unless options[:stored_credential] || options[:usage_indicator] || options[:indicator] || options[:scheduled_indicator] || options[:transaction_id]

        stored_credential = options[:stored_credential] || {}
        post[:cardOnFile] = {}
Severity: Minor
Found in lib/active_merchant/billing/gateways/shift4.rb - About 45 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

Method commit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(url, parameters = nil, options = {}, method = nil)
        if parameters.present? && parameters[:threeDSecure].present?
          three_ds_errors = validate_three_ds_params(parameters[:threeDSecure][:external])
          return three_ds_errors if three_ds_errors
        end
Severity: Minor
Found in lib/active_merchant/billing/gateways/securion_pay.rb - About 45 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

Method add_stored_credentials has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credentials(params, options)
        if options[:sequence] || options[:stored_credential]
          params[:stored_credentials] = {}
          params[:stored_credentials][:cardbrand_original_transaction_id] = original_transaction_id(options) if original_transaction_id(options)
          params[:stored_credentials][:initiator] = initiator(options) if initiator(options)
Severity: Minor
Found in lib/active_merchant/billing/gateways/payeezy.rb - About 45 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

Method add_creditcard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_creditcard(post, creditcard, options = {})
        if creditcard.respond_to?(:number)
          post[:card_number] = creditcard.number
          post[:card_expiry] = "#{creditcard.month}/#{creditcard.year}"
          post[:cvv] = creditcard.verification_value if creditcard.verification_value?
Severity: Minor
Found in lib/active_merchant/billing/gateways/fat_zebra.rb - About 45 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

Method add_address has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address(post, card, options)
        return unless address = options[:billing_address] || options[:address]

        address_object = {}
        address_object[:state] = address[:state] if address[:state]
Severity: Minor
Found in lib/active_merchant/billing/gateways/d_local.rb - About 45 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

Method parse_eci has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_eci(payment)
        return nil unless payment.is_a?(NetworkTokenizationCreditCard)

        if (eci = payment.eci)
          eci = eci[0] == '0' ? eci.sub!(/^0/, '') : eci
Severity: Minor
Found in lib/active_merchant/billing/gateways/vantiv_express.rb - About 45 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

Method create_customer_profile has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def create_customer_profile(options)
        requires!(options, :profile)
        requires!(options[:profile], :email) unless options[:profile][:merchant_customer_id] || options[:profile][:description]
        requires!(options[:profile], :description) unless options[:profile][:email] || options[:profile][:merchant_customer_id]
        requires!(options[:profile], :merchant_customer_id) unless options[:profile][:description] || options[:profile][:email]
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 45 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

Method build_non_authorized_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def build_non_authorized_request(action, money, credit_card, options)
        xml = Builder::XmlMarkup.new

        xml.tag! 'TStream' do
          xml.tag! 'Transaction' do
Severity: Minor
Found in lib/active_merchant/billing/gateways/mercury.rb - About 45 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

Method validate_three_ds_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def validate_three_ds_params(three_ds)
        errors = {}
        supported_version = %w{1.0 2.0 2.1.0 2.2.0}.include?(three_ds[:three_dsecure_version])
        supported_enrollment = ['Y', 'N', 'U', nil].include?(three_ds[:enrollment_response])
        supported_auth_response = ['Y', 'N', 'U', nil].include?(three_ds[:authentication_response])
Severity: Minor
Found in lib/active_merchant/billing/gateways/d_local.rb - About 45 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

Method add_customer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_customer(post, card, options)
        address = options[:billing_address] || {}

        post[:customer] = {}
        post[:customer][:addressLine1] = address[:address1] if address[:address1]
Severity: Minor
Found in lib/active_merchant/billing/gateways/shift4.rb - About 45 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

Method add_ship_from_address has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_ship_from_address(xml, options, root_node = 'shipFrom')
        address = options[:ship_from_address]
        return unless address

        xml.send(root_node) do
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 45 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

Method add_processing_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_processing_options(xml, options)
        return unless options[:stored_credential]

        xml.processingOptions do
          if options[:stored_credential][:initial_transaction] && options[:stored_credential][:reason_type] == 'recurring'
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 45 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

Method success_from has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def success_from(action, response, options)
        if %w[RedirectShopper ChallengeShopper].include?(response.dig('resultCode')) && !options[:execute_threed] && (!options[:threed_dynamic] || options[:ignore_threed_dynamic])
          response['refusalReason'] = 'Received unexpected 3DS authentication response, but a 3DS initiation flag was not included in the request.'
          return false
        end
Severity: Minor
Found in lib/active_merchant/billing/gateways/adyen.rb - About 45 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

Method add_address has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address(post, creditcard, options)
        if address = options[:billing_address] || options[:address]
          post[:address1]    = address[:address1].to_s
          post[:address2]    = address[:address2].to_s unless address[:address2].blank?
          post[:company]     = address[:company].to_s
Severity: Minor
Found in lib/active_merchant/billing/gateways/inspire.rb - About 45 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

Method add_surcharge_fields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_surcharge_fields(xml, options)
        surcharge = options[:surcharge] if options[:surcharge]
        if surcharge.is_a?(Hash)
          xml.surcharge do
            xml.amount(amount(surcharge[:amount].to_i)) if surcharge[:amount]
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 45 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

Method build_three_d_secure has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def build_three_d_secure(xml, three_d_secure)
        # PaymentDataSource is required when supplying the SecureECommerce data group,
        # and the gateway currently only allows the values within the mapping
        return unless PAYMENT_DATA_SOURCE_MAPPING[three_d_secure[:source].to_sym]

Severity: Minor
Found in lib/active_merchant/billing/gateways/hps.rb - About 45 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

Method commit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(post, options)
        url = (test? ? test_url : live_url)
        action = determine_action(options)
        raw_response = parse(ssl_post(url + action, post_data(post, options)))
        payload = raw_response['Ds_MerchantParameters']
Severity: Minor
Found in lib/active_merchant/billing/gateways/redsys_rest.rb - About 45 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

Method add_3ds has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_3ds(post, options)
        if options[:three_d_secure]
          post[:three_d_secure] = {}
          post[:three_d_secure][:version] = options[:three_d_secure][:version] if options[:three_d_secure][:version]
          post[:three_d_secure][:eci] = options[:three_d_secure][:eci] if options[:three_d_secure][:eci]
Severity: Minor
Found in lib/active_merchant/billing/gateways/pin.rb - About 45 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

Severity
Category
Status
Source
Language