Showing 1,501 of 1,501 total issues
Method add_passengers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_passengers(airline_options)
passengers = []
airline_options[:passengers]&.each do |flyer|
passenger = {}
passenger['firstName'] = flyer[:first_name] if flyer[:first_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_address
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_address(post, options)
billing_address = options[:billing_address] || options[:address]
if billing_address
post[:address] = billing_address[:address1]
post[:city] = billing_address[:city]
- 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_creditcard
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_creditcard(post, creditcard)
post[:CARDFULLNAME] = creditcard ? creditcard.name : ''
post[:CARDCODE] = creditcard ? creditcard.number : ''
post[:CARDVALIDITYDATE] = creditcard ? '%02d-%02s' % [creditcard.month, creditcard.year.to_s[-2..-1]] : ''
post[:CARDCVV] = creditcard ? creditcard.verification_value : ''
- 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_xml_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_xml_request(transaction_type, options = {}, transaction_id = nil, &block)
xml = Builder::XmlMarkup.new
xml.tag! 'JetPay', 'Version' => API_VERSION do
# Basic values needed for any request
xml.tag! 'TerminalID', @options[:login]
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_stored_credential(post, options)
return unless stored_credential = options[:stored_credential]
post[:cof] = stored_credential[:initiator] == 'merchant' ? 'M' : 'C'
post[:cofscheduled] = SCHEDULED_PAYMENT_TYPES.include?(stored_credential[:reason_type]) ? 'Y' : 'N'
- 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
Avoid deeply nested control flow statements. Open
card[:fallback_reason] = 'no_chip' if creditcard.read_method == 'fallback_no_chip'
Method add_payment_method
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_payment_method(post, payment_method, options)
if payment_method.is_a?(String)
customer_vault_id, = split_authorization(payment_method)
post[:customer_vault_id] = customer_vault_id
elsif payment_method.is_a?(NetworkTokenizationCreditCard)
- 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
Avoid deeply nested control flow statements. Open
card[:read_method] = 'contactless_magstripe_mode' if creditcard.read_method == 'contactless_magstripe'
Method message_from
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def message_from(success, response)
return response['status'] if success
return response['message'] if response['message']
message = nil
- 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 stored_credential_usage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def stored_credential_usage(post, payment_method, options)
return unless payment_method.brand == 'visa'
stored_credential = options[:stored_credential]
if stored_credential[:reason_type] == 'unscheduled'
- 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_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_payment_method_data(payment_method, options = {})
post = {
type: 'card',
card: {
exp_month: payment_method.month,
- 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_level_three
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_level_three(post, options = {})
level_three = {}
level_three[:merchant_reference] = options[:merchant_reference] if options[:merchant_reference]
level_three[:customer_reference] = options[:customer_reference] if options[:customer_reference]
- 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 message_from_authorization
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def message_from_authorization(response)
if response[:success]
return SUCCESS_MESSAGE
else
return CARD_CODE_MESSAGES[response[:szCVV2ResponseCode]] if CARD_CODE_ERRORS.include?(response[:szCVV2ResponseCode])
- 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 commit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def commit(action, params)
params[action == 'add_customer' ? :customer_vault : :type] = action
params[:username] = @options[:login] unless @options[:login].nil?
params[:password] = @options[:password] unless @options[:password].nil?
params[:security_key] = @options[:security_key] unless @options[:security_key].nil?
- 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_3dsecure_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_3dsecure_params(post, options)
post[:xid] = options[:xid] unless empty?(options[:xid])
post[:cavv] = options[:cavv] unless empty?(options[:cavv])
post[:ucaf_collection_ind] = options[:ucaf_collection_ind] unless empty?(options[:ucaf_collection_ind])
post[:ucaf_auth_data] = options[:ucaf_auth_data] unless empty?(options[:ucaf_auth_data])
- 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
Avoid deeply nested control flow statements. Open
card[:fallback_reason] = 'chip_error' if creditcard.read_method == 'fallback_chip_error'
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = {})
requires!(options, :merchant_id, :public_key, :private_key)
@merchant_account_id = options[:merchant_account_id]
super
- 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 map_address
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def map_address(address)
mapped = {
street_address: address[:address1],
extended_address: address[:address2],
company: address[:company],
- 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_token
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_token(reusable, name, exp_month, exp_year, number, cvc)
Method url_for
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def url_for(action, post)
if token?(post)
[(test? ? TOKEN_TEST_URL : TOKEN_LIVE_URL), action].join('/')
else
(test? ? POST_TEST_URL : POST_LIVE_URL)
- 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"