activemerchant/active_merchant

View on GitHub

Showing 1,501 of 1,501 total issues

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

      def add_descriptor(doc, options)
        if options[:descriptor_name] || options[:descriptor_phone]
          doc.customBilling do
            doc.phone(options[:descriptor_phone]) if options[:descriptor_phone]
            doc.descriptor(options[:descriptor_name]) if options[:descriptor_name]
Severity: Minor
Found in lib/active_merchant/billing/gateways/litle.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 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 add_three_d_secure has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_three_d_secure(xml, card_or_token, options)
        return unless (three_d_secure = options[:three_d_secure])

        xml.hps :Secure3D do
          xml.hps :Version, three_d_secure[:version]
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 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 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_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 add_billing_address has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_billing_address(post, options, address)
        address[:address1] = 'NA' if address[:address1].blank?
        address[:address2] = 'NA' if address[:address2].blank?

        post[:billingAddress] = {}
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 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_level_two_and_three_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_level_two_and_three_data(xml, amount, data)
        xml.invoiceReferenceNumber data[:invoice_reference_number] if data.include?(:invoice_reference_number)
        xml.customerReference data[:customer_reference] if data.include?(:customer_reference)
        xml.cardAcceptorTaxId data[:card_acceptor_tax_id] if data.include?(:card_acceptor_tax_id)
        {
Severity: Minor
Found in lib/active_merchant/billing/gateways/worldpay.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 capture has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def capture(money, authorization, options = {})
        authorization = order_id_from_authorization(authorization.to_s)
        MultiResponse.run do |r|
          r.process { inquire_request(authorization, options, 'AUTHORISED', 'CAPTURED') } unless options[:authorization_validated]
          if r.params
Severity: Minor
Found in lib/active_merchant/billing/gateways/worldpay.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_recurring_processing_model has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_recurring_processing_model(post, options)
        return unless options.dig(:stored_credential, :reason_type) || options[:recurring_processing_model]

        if options.dig(:stored_credential, :reason_type) == 'unscheduled'
          if options.dig(:stored_credential, :initiator) == 'merchant'
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 build_transaction_search has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def build_transaction_search(options)
        currency_code = options[:currency_code]
        currency_code ||= currency(options[:amount]) if options[:amount]
        transaction_search_optional_fields = %w{ Payer ReceiptID Receiver
                                                 TransactionID InvoiceID CardNumber
Severity: Minor
Found in lib/active_merchant/billing/gateways/paypal/paypal_common_api.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_payment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment(xml, payment)
        return unless payment

        if payment.is_a? String
          token = payment
Severity: Minor
Found in lib/active_merchant/billing/gateways/jetpay_v2.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_additional_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_additional_data(post, options)
        post[:ponumber] = options[:po_number]
        post[:taxamnt] = options[:tax_amount] if options[:tax_amount]
        post[:frtamnt] = options[:freight_amount] if options[:freight_amount]
        post[:dutyamnt] = options[:duty_amount] if options[:duty_amount]
Severity: Minor
Found in lib/active_merchant/billing/gateways/card_connect.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_recurring_fields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_recurring_fields(post, options)
        return unless options[:recurring_fields].is_a?(Hash)

        options[:recurring_fields].each do |key, value|
          if value == true
Severity: Minor
Found in lib/active_merchant/billing/gateways/usa_epay_transaction.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_line_items has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_line_items(post, options)
        return unless options[:line_items].is_a?(Array)

        options[:line_items].each_with_index do |line_item, index|
          %w(product_ref_num sku qty name description taxable tax_rate tax_amount commodity_code discount_rate discount_amount).each do |key|
Severity: Minor
Found in lib/active_merchant/billing/gateways/usa_epay_transaction.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_credit_request has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def build_credit_request(transaction_type, money, transaction_id, card, token, options)
Severity: Minor
Found in lib/active_merchant/billing/gateways/jetpay.rb - About 45 mins to fix
    Severity
    Category
    Status
    Source
    Language