activemerchant/active_merchant

View on GitHub

Showing 1,478 of 1,478 total issues

Method add_aggregate_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def add_aggregate_data(post, options)
        aggregate_data = {}
        data = options[:aggregate_data]
        aggregate_data[:indicator] = data[:indicator] if data[:indicator]
        aggregate_data[:identification_number] = data[:identification_number] if data[:identification_number]
Severity: Minor
Found in lib/active_merchant/billing/gateways/decidir_plus.rb - About 2 hrs 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_setup_intent has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def create_setup_intent(payment_method, options = {})
        MultiResponse.run do |r|
          r.process do
            post = {}
            add_customer(post, options)
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe_payment_intents.rb - About 2 hrs 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_aggregate_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def add_aggregate_data(post, options)
        aggregate_data = {}
        data = options[:aggregate_data]
        aggregate_data[:indicator] = data[:indicator] if data[:indicator]
        aggregate_data[:identification_number] = data[:identification_number] if data[:identification_number]
Severity: Minor
Found in lib/active_merchant/billing/gateways/decidir.rb - About 2 hrs 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 17 (exceeds 5 allowed). Consider refactoring.
Open

      def add_billing_address(post, type, options)
        if address = (options[:billing_address] || options[:address])
          billing = {}
          address = options[:billing_address] || options[:address]
          billing[:street] = address[:address1].match(/\D+/)[0].strip if address[:address1]
Severity: Minor
Found in lib/active_merchant/billing/gateways/mundipagg.rb - About 2 hrs 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_transaction_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def add_transaction_data(trans_type, post, money, options)
        currency = options[:currency] || currency(money)

        post[:sg_TransType] = trans_type
        post[:sg_Currency] = currency
Severity: Minor
Found in lib/active_merchant/billing/gateways/safe_charge.rb - About 2 hrs 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_essential_attributes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def validate_essential_attributes #:nodoc:
        errors = []

        if self.class.requires_name?
          errors << [:first_name, 'cannot be empty'] if first_name.blank?
Severity: Minor
Found in lib/active_merchant/billing/credit_card.rb - About 2 hrs 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_normal has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parse_normal(action, body)
        doc = Nokogiri::XML(body)
        doc.remove_namespaces!

        response = { action: action }
Severity: Major
Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 2 hrs to fix

    Class PaywayDotComGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class PaywayDotComGateway < Gateway
          self.test_url = 'https://paywaywsdev.com/PaywayWS/Payment/CreditCard'
          self.live_url = 'https://paywayws.net/PaywayWS/Payment/CreditCard'
    
          self.supported_countries = %w[US CA]
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/payway_dot_com.rb - About 2 hrs to fix

      Class VposGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class VposGateway < Gateway
            self.test_url = 'https://vpos.infonet.com.py:8888'
            self.live_url = 'https://vpos.infonet.com.py'
      
            self.supported_countries = ['PY']
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/vpos.rb - About 2 hrs to fix

        Class IridiumGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class IridiumGateway < Gateway
              self.live_url = self.test_url = 'https://gw1.iridiumcorp.net/'
        
              # The countries the gateway supports merchants from as 2 digit ISO country codes
              self.supported_countries = %w[GB ES]
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/iridium.rb - About 2 hrs to fix

          Class CC5Gateway has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class CC5Gateway < Gateway
                self.default_currency = 'TRY'
          
                CURRENCY_CODES = {
                  'TRY' => 949,
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/cc5.rb - About 2 hrs to fix

            Class CamsGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class CamsGateway < Gateway
                  self.live_url = 'https://secure.centralams.com/gw/api/transact.php'
            
                  self.supported_countries = ['US']
                  self.default_currency = 'USD'
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/cams.rb - About 2 hrs to fix

              Class CheckoutGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class CheckoutGateway < Gateway
                    self.default_currency = 'USD'
                    self.money_format = :cents
              
                    self.supported_countries = %w[AD AT BE BG CH CY CZ DE DK EE ES FO FI FR GB GI GL GR HR HU IE IS IL IT LI LT LU LV MC MT NL NO PL PT RO SE SI SM SK SJ TR VA]
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/checkout.rb - About 2 hrs to fix

                Class InspireGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class InspireGateway < Gateway
                      self.live_url = self.test_url = 'https://secure.inspiregateway.net/api/transact.php'
                
                      self.supported_countries = ['US']
                      self.supported_cardtypes = %i[visa master american_express]
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/inspire.rb - About 2 hrs to fix

                  Class MitGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class MitGateway < Gateway
                        self.live_url = 'https://wpy.mitec.com.mx/ModuloUtilWS/activeCDP.htm'
                        self.test_url = 'https://scqa.mitec.com.mx/ModuloUtilWS/activeCDP.htm'
                  
                        self.supported_countries = ['MX']
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/mit.rb - About 2 hrs to fix

                    Class WepayGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class WepayGateway < Gateway
                          self.test_url = 'https://stage.wepayapi.com/v2'
                          self.live_url = 'https://wepayapi.com/v2'
                    
                          self.supported_countries = %w[US CA]
                    Severity: Minor
                    Found in lib/active_merchant/billing/gateways/wepay.rb - About 2 hrs to fix

                      Class ModernPaymentsCimGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class ModernPaymentsCimGateway < Gateway #:nodoc:
                            self.test_url = 'https://secure.modpay.com/netservices/test/ModpayTest.asmx'
                            self.live_url = 'https://secure.modpay.com/ws/modpay.asmx'
                      
                            LIVE_XMLNS = 'https://secure.modpay.com/ws/'
                      Severity: Minor
                      Found in lib/active_merchant/billing/gateways/modern_payments_cim.rb - About 2 hrs to fix

                        Class ItransactGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                            class ItransactGateway < Gateway
                              self.live_url = self.test_url = 'https://secure.paymentclearing.com/cgi-bin/rc/xmltrans2.cgi'
                        
                              # The countries the gateway supports merchants from as 2 digit ISO country codes
                              self.supported_countries = ['US']
                        Severity: Minor
                        Found in lib/active_merchant/billing/gateways/itransact.rb - About 2 hrs to fix

                          Class SoEasyPayGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class SoEasyPayGateway < Gateway
                                self.live_url = self.test_url = 'https://secure.soeasypay.com/gateway.asmx'
                                self.money_format = :cents
                          
                                self.supported_countries = %w[
                          Severity: Minor
                          Found in lib/active_merchant/billing/gateways/so_easy_pay.rb - About 2 hrs to fix

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                  TRANSACTION_RESPONSE_CODES = {
                                    '00' => 'Success',
                                    '1' => 'Transaction blocked by issuer',
                                    '4' => 'Pick up card and deny transaction',
                                    '5' => 'Problem with the account',
                            Severity: Major
                            Found in lib/active_merchant/billing/gateways/pro_pay.rb and 1 other location - About 2 hrs to fix
                            lib/active_merchant/billing/gateways/plugnpay.rb on lines 39..79

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 82.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Severity
                            Category
                            Status
                            Source
                            Language