Showing 1,005 of 1,501 total issues
Method build_refund_request
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def build_refund_request(money, identification, options)
xml = Builder::XmlMarkup.new
xml.tag! 'RefundTransactionReq', 'xmlns' => PAYPAL_NAMESPACE do
xml.tag! 'RefundTransactionRequest', 'xmlns:n2' => EBAY_NAMESPACE do
- 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
Method add_shipping_address
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_shipping_address(post, options)
return unless shipping = options[:shipping_address]
shipping_address = {}
address = {}
- 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
Method build_sale_or_authorization_request
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def build_sale_or_authorization_request(action, money, credit_card_or_referenced_id, options)
transaction_type = define_transaction_type(credit_card_or_referenced_id)
reference_id = credit_card_or_referenced_id if transaction_type == 'DoReferenceTransaction'
billing_address = options[:billing_address] || options[:address]
- 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
Method flatten_params
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def flatten_params(flattened, params, prefix = nil)
params.each do |key, value|
next if value != false && value.blank?
flattened_key = prefix.nil? ? key : "#{prefix}[#{key}]"
- 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
Method store
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def store(payment_method, options = {})
params = {}
# If customer option is provided, create a payment method and attach to customer id
# Otherwise, create a customer, then attach
if new_apple_google_pay_flow(payment_method, options)
- 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
Method add_credit_card_to_customer
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_credit_card_to_customer(credit_card, options)
commit do
parameters = {
customer_id: options[:customer],
token: options[:credit_card_token],
- 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
Method create_transaction_parameters
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create_transaction_parameters(money, credit_card_or_vault_id, options)
parameters = {
amount: localized_amount(money, options[:currency] || default_currency).to_s,
order_id: options[:order_id],
customer: {
- 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
Method ensure_credentials
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def ensure_credentials(try_again = true)
multiresp = MultiResponse.new
access_token = @options[:access_token]
key = @options[:encryption_key]
uuid = @options[:encryption_uuid]
- 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
Method add_address
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_address(xml, address)
xml.tag!('v1:Address') do
xml.tag!('v1:Address1', address[:address1]) if address[:address1]
xml.tag!('v1:Address2', address[:address2]) if address[:address2]
xml.tag!('v1:Zip', address[:zip]) if address[:zip]
- 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
Method add_product_details
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_product_details(post, options)
return unless options[:product_details]
product_items_array = []
options[:product_details].each do |item|
- 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
Method add_transaction_control
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_transaction_control(xml, options)
xml.TransactionControl {
# if there was a 'global' option set...
xml.TestMode(@options[:test_mode].upcase) if !@options[:test_mode].blank?
# allow the global option to be overridden...
- 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
Method add_shipping
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_shipping(post, options = {})
return post unless options.key?(:shipping_address)
shipping = options[:shipping_address]
post[:meta][:shipping_info] = {}
- 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
Method add_payment_method
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_payment_method(post, payment_method, options)
if payment_method.is_a?(String)
brand, token = split_authorization(payment_method)
credit_card = {}
credit_card[:securityCode] = options[:cvv] if options[:cvv]
- 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
Method add_three_d_secure
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_three_d_secure(xml, three_d_secure)
xml.tag!('v1:CreditCard3DSecure') do
xml.tag!('v1:AuthenticationValue', three_d_secure[:cavv]) if three_d_secure[:cavv]
xml.tag!('v1:XID', three_d_secure[:xid]) if three_d_secure[:xid]
xml.tag!('v1:Secure3D2TransactionStatus', three_d_secure[:directory_response_status]) if three_d_secure[:directory_response_status]
- 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
Method parse_element
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parse_element(reply, node)
if node.has_elements?
node.elements.each { |e| parse_element(reply, e) }
else
if /item/.match?(node.parent.name)
- 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
Method add_merchant_description
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_merchant_description(xml, options)
return unless options[:merchant_descriptor_name] || options[:merchant_descriptor_address1] || options[:merchant_descriptor_locality]
xml.tag! 'merchantInformation' do
xml.tag! 'merchantDescriptor' do
- 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
Method add_ecp_details
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_ecp_details(xml, payment_source, parameters = {})
requires!(payment_source.account_number) if parameters[:auth_method]&.eql?('A') || parameters[:auth_method]&.eql?('P')
xml.tag! :ECPActionCode, parameters[:action_code] if parameters[:action_code]
xml.tag! :ECPCheckSerialNumber, payment_source.account_number if parameters[:auth_method]&.eql?('A') || parameters[:auth_method]&.eql?('P')
if parameters[:auth_method]&.eql?('P')
- 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
Method add_stored_credential_options
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_stored_credential_options(xml, options = {})
return unless options[:stored_credential] || options[:stored_credential_overrides]
stored_credential_subsequent_auth_first = 'true' if cardholder_or_initiated_transaction?(options)
stored_credential_transaction_id = options.dig(:stored_credential, :network_transaction_id) if options.dig(:stored_credential, :initiator) == 'merchant'
- 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
Method add_payment_method
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_payment_method(doc, payment_method, options)
if payment_method.is_a?(String)
doc.token do
doc.litleToken(payment_method)
doc.expDate(format_exp_date(options[:basis_expiration_month], options[:basis_expiration_year])) if options[:basis_expiration_month] && options[:basis_expiration_year]
Method add_customer_with_credit_card
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_customer_with_credit_card(creditcard, options)
commit do
if options[:payment_method_nonce]
credit_card_params = { payment_method_nonce: options[:payment_method_nonce] }
else