Showing 1,478 of 1,478 total issues
Class MerchantWarriorGateway
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class MerchantWarriorGateway < Gateway
TOKEN_TEST_URL = 'https://base.merchantwarrior.com/token/'
TOKEN_LIVE_URL = 'https://api.merchantwarrior.com/token/'
POST_TEST_URL = 'https://base.merchantwarrior.com/post/'
Identical blocks of code found in 2 locations. Consider refactoring. Open
xml.LodgingAgreementNumber lodging[:agreement_number] if lodging[:agreement_number]
xml.LodgingCheckInDate lodging[:check_in_date] if lodging[:check_in_date]
xml.LodgingCheckOutDate lodging[:check_out_date] if lodging[:check_out_date]
xml.LodgingRoomAmount lodging[:room_amount] if lodging[:room_amount]
xml.LodgingRoomTax lodging[:room_tax] if lodging[:room_tax]
- 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 127.
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
xml.LodgingAgreementNumber lodging[:agreement_number] if lodging[:agreement_number]
xml.LodgingCheckInDate lodging[:check_in_date] if lodging[:check_in_date]
xml.LodgingCheckOutDate lodging[:check_out_date] if lodging[:check_out_date]
xml.LodgingRoomAmount lodging[:room_amount] if lodging[:room_amount]
xml.LodgingRoomTax lodging[:room_tax] if lodging[:room_tax]
- 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 127.
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 add_address(post, options)
if address = (options[:billing_address] || options[:address])
post[:company] = address[:company]
post[:address1] = address[:address1]
post[:address2] = address[:address2]
- 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 126.
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 add_address(post, options)
if address = (options[:billing_address] || options[:address])
post[:company] = address[:company]
post[:address1] = address[:address1]
post[:address2] = address[:address2]
- 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 126.
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
File mundipagg.rb
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class MundipaggGateway < Gateway
self.live_url = 'https://api.mundipagg.com/core/v1'
Method add_card_or_token_payment
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def add_card_or_token_payment(xml, card_or_token, options)
xml.hps :CardData do
if card_or_token.respond_to?(:number)
if card_or_token.track_data
xml.tag!('hps:TrackData', 'method' => 'swipe') 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_customer
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def add_customer(request, payment_method, options)
address = options[:billing_address] || options[:address]
request[:customer] = {}
request[:customer][:email] = options[:email] || 'support@monei.net'
- 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
File paymentez.rb
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'base64'
require 'digest'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
Class UsaEpayTransactionGateway
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class UsaEpayTransactionGateway < Gateway
self.live_url = 'https://www.usaepay.com/gate'
self.test_url = 'https://sandbox.usaepay.com/gate'
self.supported_cardtypes = %i[visa master american_express]
Class JetpayGateway
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class JetpayGateway < Gateway
class_attribute :live_us_url, :live_ca_url
self.test_url = 'https://test1.jetpay.com/jetpay'
self.live_us_url = 'https://gateway17.jetpay.com/jetpay'
Class CardStreamGateway
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class CardStreamGateway < Gateway
THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE = 'Specifying the :threeDSRequired initialization option is deprecated. Please use the `:threeds_required => true` *transaction* option instead.'
self.test_url = self.live_url = 'https://gateway.cardstream.com/direct/'
self.money_format = :cents
Class SpreedlyCoreGateway
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class SpreedlyCoreGateway < Gateway
self.live_url = 'https://core.spreedly.com/v1'
self.supported_countries = %w(AD AE AT AU BD BE BG BN CA CH CY CZ DE DK EE EG ES FI FR GB
GI GR HK HU ID IE IL IM IN IS IT JO KW LB LI LK LT LU LV MC
Class MigsGateway
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class MigsGateway < Gateway
include MigsCodes
API_VERSION = 1
Class FlexChargeGateway
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class FlexChargeGateway < Gateway
self.test_url = 'https://api-sandbox.flex-charge.com/v1/'
self.live_url = 'https://api.flex-charge.com/v1/'
self.supported_countries = ['US']
File simetrik.rb
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class SimetrikGateway < Gateway
self.test_url = 'https://payments.sta.simetrik.com/v1'
self.live_url = 'https://payments.simetrik.com/v1'
File trust_commerce.rb
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
begin
require 'tclink'
rescue LoadError
# Falls back to an SSL post to TrustCommerce
end
File priority.rb
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class PriorityGateway < Gateway
# Sandbox and Production
self.test_url = 'https://sandbox.api.mxmerchant.com/checkout/v3/payment'
Method add_fraud_detection
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def add_fraud_detection(options = {})
{}.tap do |hsh|
hsh[:send_to_cs] = options[:send_to_cs] if valid_fraud_detection_option?(options[:send_to_cs]) # true/false
hsh[:channel] = options[:channel] if valid_fraud_detection_option?(options[:channel])
hsh[:dispatch_method] = options[:dispatch_method] if valid_fraud_detection_option?(options[:dispatch_method])
- 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_billing
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def add_billing(xml, billing)
xml.tag!('v1:Billing') do
xml.tag!('v1:CustomerID', billing[:customer_id]) if billing[:customer_id]
xml.tag!('v1:Name', billing[:name]) if billing[:name]
xml.tag!('v1:Company', billing[:company]) if billing[: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"