Shopify/active_merchant

View on GitHub
lib/active_merchant/billing/gateways/trans_first_transaction_express.rb

Summary

Maintainability
F
3 days
Test Coverage

Method add_contact has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
Open

      def add_contact(doc, fullname, options)
        doc['v1'].contact do
          doc['v1'].fullName fullname unless fullname.blank?
          doc['v1'].coName options[:company_name] if options[:company_name]
          doc['v1'].title options[:title] if options[:title]

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

File trans_first_transaction_express.rb has 509 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'nokogiri'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    class TransFirstTransactionExpressGateway < Gateway

    Class TransFirstTransactionExpressGateway has 43 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class TransFirstTransactionExpressGateway < Gateway
          self.display_name = 'TransFirst Transaction Express'
          self.homepage_url = 'http://transactionexpress.com/'
    
          self.test_url = 'https://ws.cert.transactionexpress.com/portal/merchantframework/MerchantWebServices-v1?wsdl'

      Method add_contact has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def add_contact(doc, fullname, options)
              doc['v1'].contact do
                doc['v1'].fullName fullname unless fullname.blank?
                doc['v1'].coName options[:company_name] if options[:company_name]
                doc['v1'].title options[:title] if options[:title]

        There are no issues that match your filters.

        Category
        Status