activemerchant/active_merchant

View on GitHub

Showing 1,005 of 1,501 total issues

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

      def commit(request, action, amount, options)
        begin
          raw_response = ssl_post(test? ? self.test_url : self.live_url, build_request(request, options))
        rescue ResponseError => e
          raw_response = e.response.body
Severity: Minor
Found in lib/active_merchant/billing/gateways/cyber_source.rb - About 35 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_void_request_xml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def build_void_request_xml(authorization, parameters = {})
        tx_ref_num, order_id = split_authorization(authorization)
        xml = xml_envelope
        xml.tag! :Request do
          xml.tag! :Reversal do
Severity: Minor
Found in lib/active_merchant/billing/gateways/orbital.rb - About 35 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_invoice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_invoice(doc, money, options)
        doc.amount amount(money) unless money.nil?
        doc.currency_code(options[:currency] || currency(money) || default_currency)
        doc.order_id(options[:order_id])
        doc.ip(options[:ip]) if options[:ip]
Severity: Minor
Found in lib/active_merchant/billing/gateways/spreedly_core.rb - About 35 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 do_authorize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def do_authorize(params)
        headers = {}
        headers['Referer'] = (options[:password] || 'activemerchant.org')

        response = raw_ssl_request(:post, live_url + 'auth/default.aspx', authorize_post_data(params), headers)
Severity: Minor
Found in lib/active_merchant/billing/gateways/epay.rb - About 35 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 get_msg_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def get_msg_type(parameters)
        return parameters[:mit_msg_type] if parameters[:mit_msg_type]
        return 'CSTO' if parameters[:stored_credential][:initial_transaction]
        return unless parameters[:stored_credential][:initiator] && parameters[:stored_credential][:reason_type]

Severity: Minor
Found in lib/active_merchant/billing/gateways/orbital.rb - About 35 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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def process(ignore_result = false)
        return unless success?

        response = yield
        self << response
Severity: Minor
Found in lib/active_merchant/billing/response.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(action, post, authorization = nil, method = :post)
        MultiResponse.run do |r|
          r.process { fetch_access_token } unless access_token_valid?
          r.process do
            api_request(action, post, authorization, method).tap do |response|
Severity: Minor
Found in lib/active_merchant/billing/gateways/flex_charge.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credentials(xml, parameters)
        return unless parameters[:mit_stored_credential_ind] == 'Y' || parameters[:stored_credential] && !parameters[:stored_credential].values.all?(&:nil?)

        if msg_type = get_msg_type(parameters)
          xml.tag! :MITMsgType, msg_type
Severity: Minor
Found in lib/active_merchant/billing/gateways/orbital.rb - About 35 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 too many return statements within this method.
Open

          return response[:szAuthorizationDeclinedMessage]
Severity: Major
Found in lib/active_merchant/billing/gateways/skip_jack.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return response_code if response_code
    Severity: Major
    Found in lib/active_merchant/billing/gateways/payu_latam.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                return base + 'vault/payment-instrument/token'
      Severity: Major
      Found in lib/active_merchant/billing/gateways/deepstack.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return base + 'noaction'
        Severity: Major
        Found in lib/active_merchant/billing/gateways/deepstack.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return base + 'vault/token'
          Severity: Major
          Found in lib/active_merchant/billing/gateways/deepstack.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      return base + 'payments/refund'
            Severity: Major
            Found in lib/active_merchant/billing/gateways/deepstack.rb - About 30 mins to fix

              Method post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def post(data, use_profile_api = nil)
                      response = parse(ssl_post((use_profile_api ? SECURE_PROFILE_URL : self.live_url), data))
                      response[:customer_vault_id] = response[:customerCode] if response[:customerCode]
                      build_response(
                        success?(response),
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def add_stored_credentials(post, options)
                      return unless (stored_creds = options[:stored_credential])
              
                      post[:cof_info] = {
                        cof_type: stored_creds[:initial_transaction] ? 'initial' : 'stored',
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/ebanx.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def add_three_d_secure(post, options)
                      params = post[:parametros] ||= {}
                      return unless three_d_secure = options[:three_d_secure]
              
                      params[:exencionSCA] ||= CECA_SCA_TYPES.fetch(options[:exemption_type]&.to_sym, :NONE)
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb - About 25 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 check_token_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def check_token_response(response, endpoint, body = {}, options = {})
                      return response unless @options[:refresh_token]
                      return response unless options[:allow_refresh]
                      return response unless response.params['code'] == 'AuthenticationFailed'
              
              
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/quickbooks.rb - About 25 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 cvv_code_from has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def cvv_code_from(response)
                      if response['errors'].present?
                        FRAUD_WARNING_CODES.include?(response['errors'].first['code']) ? 'I' : ''
                      else
                        success?(response) ? 'M' : ''
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/quickbooks.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def add_address(post, options)
                      if address = options[:billing_address] || options[:address]
                        post[:payment][:address] = address[:address1].split[1..-1].join(' ') if address[:address1]
                        post[:payment][:street_number] = address[:address1].split.first if address[:address1]
                        post[:payment][:city] = address[:city]
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/ebanx.rb - About 25 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