activemerchant/active_merchant

View on GitHub

Showing 984 of 1,463 total issues

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

      def add_stored_credential(post, options)
        return unless stored_credential = options[:stored_credential]

        post[:cof] = stored_credential[:initiator] == 'merchant' ? 'M' : 'C'
        post[:cofscheduled] = SCHEDULED_PAYMENT_TYPES.include?(stored_credential[:reason_type]) ? 'Y' : 'N'
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_creditcard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_creditcard(post, creditcard)
        post[:CARDFULLNAME]     = creditcard ? creditcard.name : ''
        post[:CARDCODE]         = creditcard ? creditcard.number : ''
        post[:CARDVALIDITYDATE] = creditcard ? '%02d-%02s' % [creditcard.month, creditcard.year.to_s[-2..-1]] : ''
        post[:CARDCVV]          = creditcard ? creditcard.verification_value : ''
Severity: Minor
Found in lib/active_merchant/billing/gateways/be2bill.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 build_xml_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def build_xml_request(transaction_type, options = {}, transaction_id = nil, &block)
        xml = Builder::XmlMarkup.new
        xml.tag! 'JetPay', 'Version' => API_VERSION do
          # Basic values needed for any request
          xml.tag! 'TerminalID', @options[:login]
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_address has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address(post, options)
        billing_address = options[:billing_address] || options[:address]
        if billing_address
          post[:address] = billing_address[:address1]
          post[:city] = billing_address[:city]
Severity: Minor
Found in lib/active_merchant/billing/gateways/iats_payments.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_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

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

          def message_from_authorization(response)
            if response[:success]
              return SUCCESS_MESSAGE
            else
              return CARD_CODE_MESSAGES[response[:szCVV2ResponseCode]] if CARD_CODE_ERRORS.include?(response[:szCVV2ResponseCode])
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/skip_jack.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_passengers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_passengers(airline_options)
            passengers = []
            airline_options[:passengers]&.each do |flyer|
              passenger = {}
              passenger['firstName'] = flyer[:first_name] if flyer[:first_name]
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/global_collect.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_3dsecure_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_3dsecure_params(post, options)
            post[:xid] = options[:xid] unless empty?(options[:xid])
            post[:cavv] = options[:cavv] unless empty?(options[:cavv])
            post[:ucaf_collection_ind] = options[:ucaf_collection_ind] unless empty?(options[:ucaf_collection_ind])
            post[:ucaf_auth_data] = options[:ucaf_auth_data] unless empty?(options[:ucaf_auth_data])
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/merchant_e_solutions.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

    Avoid deeply nested control flow statements.
    Open

                  card[:fallback_reason] = 'no_chip' if creditcard.read_method == 'fallback_no_chip'
    Severity: Major
    Found in lib/active_merchant/billing/gateways/stripe.rb - About 45 mins to fix

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

            def add_payment_method(post, payment_method, options)
              if payment_method.is_a?(String)
                customer_vault_id, = split_authorization(payment_method)
                post[:customer_vault_id] = customer_vault_id
              elsif payment_method.is_a?(NetworkTokenizationCreditCard)
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/nmi.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

      Avoid deeply nested control flow statements.
      Open

                    card[:read_method] = 'contactless_magstripe_mode' if creditcard.read_method == 'contactless_magstripe'
      Severity: Major
      Found in lib/active_merchant/billing/gateways/stripe.rb - About 45 mins to fix

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

              def stored_credential_usage(post, payment_method, options)
                return unless payment_method.brand == 'visa'
        
                stored_credential = options[:stored_credential]
                if stored_credential[:reason_type] == 'unscheduled'
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/qvalent.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_credential has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_stored_credential(xml, options)
                network_transaction_id = options.dig(:stored_credential, :network_transaction_id)
                case
                when network_transaction_id.nil?
                  return
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/elavon.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