Showing 999 of 1,496 total issues
Method add_address
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
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)
- Read upRead up
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
Consider simplifying this complex logical expression. Open
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'
Method log_with_retry_details
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def log_with_retry_details(logger, attempts, time, message, tag)
Method add_auth_invoice_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_auth_invoice_data(action, post, money, authorization, options)
Method generate_hash_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def generate_hash_data(order_id, terminal_id, credit_card_number, amount, security_data)
Method commit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def commit(action, post, options, authorization = nil, method = :post)
Method response
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def response(action, succeeded, response, options = {}, source_id = nil)
Method perform_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def perform_request(action, post, options, authorization = nil, method = :post)
Method build_authorized_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build_authorized_request(action, money, authorization, credit_card, options)
Method add_customerdetails
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_customerdetails(xml, creditcard, address, options, shipTo = false)
Method add_reference
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_reference(post, orderid, transactionid, transaction_reference, reference_key = :reference)
Method add_auth_purchase_params
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_auth_purchase_params(post, money, card, action, options)
Method add_transaction_details
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_transaction_details(xml, amount, authorization, type, options = {})
Method add_address
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_address(xml, creditcard, address, options, shipTo = false)
Method build_field_value_array
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build_field_value_array(soap, tag_name, type, custom_data, fields)
Method add_cim_auth_purchase
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_cim_auth_purchase(xml, transaction_type, amount, payment, options)
Method add_address
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_address(post, payment_method, address, options, address_type)
Method add_auth_purchase
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_auth_purchase(xml, transaction_type, amount, payment, options)
Method add_mobile_credit_card
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_mobile_credit_card(post, payment, options, specifics_inputs, expirydate)
Method commit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def commit(action, options, verb = :post, payment_method_details = PaymentMethodDetails.new(), &block)