activemerchant/active_merchant

View on GitHub

Showing 1,005 of 1,501 total issues

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

      def add_address(doc, options)
        address = options[:billing_address] || {}
        doc.country(address[:country] ? lookup_country_code(address[:country]) : 'NA')
        doc.city(address[:city] || 'City')
        doc.line1(address[:address1] || 'Address')
Severity: Minor
Found in lib/active_merchant/billing/gateways/telr.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 message_from has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def message_from(results)
        if results[:response_code] == DECLINED
          return CVVResult.messages[results[:card_code]] if CARD_CODE_ERRORS.include?(results[:card_code])
          return AVSResult.messages[results[:avs_result_code]] if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
        end
Severity: Minor
Found in lib/active_merchant/billing/gateways/secure_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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def validate
        errors = []

        %i[name routing_number account_number].each do |attr|
          errors << [attr, 'cannot be empty'] if empty?(self.send(attr))
Severity: Minor
Found in lib/active_merchant/billing/check.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(xml, payment_source, options)
        return unless (address = get_address(options))

        if avs_supported?(address[:country]) || empty?(address[:country])
          xml.tag! :AVSzip, byte_limit(format_address_field(address[:zip]), 10)
Severity: Minor
Found in lib/active_merchant/billing/gateways/orbital.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

                opt_element.add_element('value').text = option[:value] unless option[:value].blank?
Severity: Major
Found in lib/active_merchant/billing/gateways/linkpoint.rb - About 45 mins to fix

    Consider simplifying this complex logical expression.
    Open

            elsif response['error_type']
              response['error_type'] + ': ' + response['error_codes'].first
            else
              response_summary = response['response_summary'] || response.dig('actions', 0, 'response_summary')
              response_summary || response['response_code'] || response['status'] || response['message'] || 'Unable to read error message'
    Severity: Major
    Found in lib/active_merchant/billing/gateways/checkout_v2.rb - About 40 mins to fix

      Method commit has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def commit(action, post, options, authorization = nil, method = :post)
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/checkout_v2.rb - About 35 mins to fix

        Method add_auth_invoice_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def add_auth_invoice_data(action, post, money, authorization, options)
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb - About 35 mins to fix

          Method perform_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def perform_request(action, post, options, authorization = nil, method = :post)
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/checkout_v2.rb - About 35 mins to fix

            Method generate_hash_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def generate_hash_data(order_id, terminal_id, credit_card_number, amount, security_data)
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/garanti.rb - About 35 mins to fix

              Method log_with_retry_details has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def log_with_retry_details(logger, attempts, time, message, tag)
              Severity: Minor
              Found in lib/active_merchant/network_connection_retries.rb - About 35 mins to fix

                Method response has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      def response(action, succeeded, response, options = {}, source_id = nil)
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/checkout_v2.rb - About 35 mins to fix

                  Method execute_3ds_flow has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def execute_3ds_flow(post, money, payment, transaction_type, options = {})
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/nuvei.rb - About 35 mins to fix

                    Method add_reference has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def add_reference(post, orderid, transactionid, transaction_reference, reference_key = :reference)
                    Severity: Minor
                    Found in lib/active_merchant/billing/gateways/mastercard.rb - About 35 mins to fix

                      Method build_authorized_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                            def build_authorized_request(action, money, authorization, credit_card, options)
                      Severity: Minor
                      Found in lib/active_merchant/billing/gateways/mercury.rb - About 35 mins to fix

                        Method add_auth_purchase_params has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                              def add_auth_purchase_params(post, money, card, action, options)
                        Severity: Minor
                        Found in lib/active_merchant/billing/gateways/d_local.rb - About 35 mins to fix

                          Method add_customerdetails has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                def add_customerdetails(xml, creditcard, address, options, shipTo = false)
                          Severity: Minor
                          Found in lib/active_merchant/billing/gateways/iridium.rb - About 35 mins to fix

                            Method add_transaction_details has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                  def add_transaction_details(xml, amount, authorization, type, options = {})
                            Severity: Minor
                            Found in lib/active_merchant/billing/gateways/creditcall.rb - About 35 mins to fix

                              Method add_address has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                    def add_address(xml, creditcard, address, options, shipTo = false)
                              Severity: Minor
                              Found in lib/active_merchant/billing/gateways/quantum.rb - About 35 mins to fix

                                Method add_address has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                      def add_address(post, payment_method, address, options, address_type)
                                Severity: Minor
                                Found in lib/active_merchant/billing/gateways/cyber_source_rest.rb - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language