Showing 1,501 of 1,501 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
MESSAGES = {
'A' => 'Street address matches, but postal code does not match.',
'B' => 'Street address matches, but postal code not verified.',
'C' => 'Street address and postal code do not match.',
'D' => 'Street address and postal code match.',
- Read upRead up
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 54.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if value.is_a?(Hash)
h = {}
value.each do |k, v|
h["#{key}[#{k}]"] = v unless v.blank?
end
- Read upRead up
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 54.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
AVS_CODE_TRANSLATOR = {
'0' => 'Approved, Address verification was not requested.',
'A' => 'Approved, Address matches only.',
'B' => 'Address Match. Street Address math for international transaction Postal Code not verified because of incompatible formats (Acquirer sent both street address and Postal Code)',
'C' => 'Serv Unavailable. Street address and Postal Code not verified for international transaction because of incompatible formats (Acquirer sent both street and Postal Code).',
- Read upRead up
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 54.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method build_credit_card_request
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_credit_card_request(action, money, credit_card, options)
xml = Builder::XmlMarkup.new
xml.tag! TRANSACTIONS[action] do
xml.tag! 'PayData' do
xml.tag! 'Invoice' do
Method build_reference_sale_or_authorization_request
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_reference_sale_or_authorization_request(action, money, reference, options)
xml = Builder::XmlMarkup.new
xml.tag! TRANSACTIONS[action] do
xml.tag! 'PayData' do
xml.tag! 'Invoice' do
Method credit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def credit(money, creditcard, options = {})
post = payment_request(money, options)
post[:amount] = amount_hash(money, options[:currency])
post[:card] = credit_card_hash(creditcard)
post[:dateOfBirth] = options[:date_of_birth] if options[:date_of_birth]
Method store
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def store(payment, options = {})
params = {}
post = {}
if payment.is_a?(ApplePayPaymentToken)
Method add_auth_wallet
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_auth_wallet(xml, payment_method, options)
commerce_indicator = 'internet' if subsequent_nt_apple_pay_auth(payment_method.source, options)
brand = card_brand(payment_method).to_sym
Identical blocks of code found in 2 locations. Consider refactoring. Open
def parse_element(node)
if node.has_elements?
response = {}
node.elements.each { |e|
key = e.name.underscore
- Read upRead up
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 53.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
def parse_element(node)
if node.has_elements?
response = {}
node.elements.each do |e|
key = e.name.underscore
- Read upRead up
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 53.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method add_addresses
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_addresses(post, options)
if address = options[:billing_address] || options[:address]
post[:card_address1] = address[:address1]
post[:card_zip] = address[:zip]
post[:card_city] = address[:city]
Method soap_request
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def soap_request(arguments, action)
# eWay demands all fields be sent, but contain an empty string if blank
post = case action
when 'QueryCustomer'
arguments
Method parse
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(action, soap)
xml = REXML::Document.new(soap)
root = REXML::XPath.first(xml, '//SOAP-ENV:Body')
response = root ? parse_element(root[0]) : { response: soap }
Method commit
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def commit(action, money, parameters)
case action
when 'sale'
begin
response = call_api(TRANSACTION_API, parameters)
Method update
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update(vault_id, creditcard, options = {})
braintree_credit_card = nil
commit do
braintree_credit_card = @braintree_gateway.customer.find(vault_id).credit_cards.detect(&:default?)
return Response.new(false, 'Braintree::NotFoundError') if braintree_credit_card.nil?
Method build_create_subscription_request
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_create_subscription_request(payment_method, options)
default_subscription_params = { frequency: 'on-demand', amount: 0, automatic_renew: false }
options[:subscription] = default_subscription_params.update(
options[:subscription] || {}
)
Method add_pay_data
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_pay_data(xml, money, options)
xml.tag! 'PayData' do
xml.tag! 'Invoice' do
xml.tag! 'CustIP', options[:ip] unless options[:ip].blank?
xml.tag! 'InvNum', options[:order_id] unless options[:order_id].blank?
Method add_payout_sender_data
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_payout_sender_data(post, options)
return unless options[:payout] == true
post[:sender] = {
# options for type are individual, corporate, or government
Method parse
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(body)
response = {}
root = REXML::Document.new(body).root
Method avs_mapping
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def avs_mapping
{
'street: M, zip: M' => 'M',
'street: M, zip: N' => 'A',
'street: M, zip: U' => 'B',