Showing 1,478 of 1,478 total issues
Method build_mass_pay_request
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def build_mass_pay_request(*args)
default_options = args.last.is_a?(Hash) ? args.pop : {}
recipients = args.first.is_a?(Array) ? args : [args]
receiver_type = default_options[:receiver_type]
- 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_reference_request
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def build_reference_request(action, money, authorization, options)
xml = Builder::XmlMarkup.new
xml.tag! TRANSACTIONS[action] do
xml.tag! 'PNRef', authorization
- 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 firstdata_e4.rb
has 343 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class FirstdataE4Gateway < Gateway
# TransArmor support requires v11 or lower
self.test_url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v11'
File jetpay.rb
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class JetpayGateway < Gateway
class_attribute :live_us_url, :live_ca_url
Class SimetrikGateway
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class SimetrikGateway < Gateway
self.test_url = 'https://payments.sta.simetrik.com/v1'
self.live_url = 'https://payments.simetrik.com/v1'
class_attribute :test_auth_url, :live_auth_url, :test_audience, :live_audience
Class OptimalPaymentGateway
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class OptimalPaymentGateway < Gateway
self.test_url = 'https://webservices.test.optimalpayments.com/creditcardWS/CreditCardServlet/v1'
self.live_url = 'https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1'
# The countries the gateway supports merchants from as 2 digit ISO country codes
Class PlexoGateway
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class PlexoGateway < Gateway
self.test_url = 'https://api.testing.plexo.com.uy/v1/payments'
self.live_url = 'https://api.plexo.com.uy/v1/payments'
self.supported_countries = ['UY']
Class RedsysRestGateway
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class RedsysRestGateway < Gateway
self.test_url = 'https://sis-t.redsys.es:25443/sis/rest/'
self.live_url = 'https://sis.redsys.es/sis/rest/'
self.supported_countries = ['ES']
Class CardConnectGateway
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class CardConnectGateway < Gateway
self.test_url = 'https://fts-uat.cardconnect.com/cardconnect/rest/'
self.live_url = 'https://fts.cardconnect.com/cardconnect/rest/'
self.supported_countries = ['US']
Class KushkiGateway
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class KushkiGateway < Gateway
self.display_name = 'Kushki'
self.homepage_url = 'https://www.kushkipagos.com'
self.test_url = 'https://api-uat.kushkipagos.com/'
Class BluePayGateway
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class BluePayGateway < Gateway
class_attribute :rebilling_url, :ignore_http_status
self.live_url = 'https://secure.bluepay.com/interfaces/bp20post'
self.rebilling_url = 'https://secure.bluepay.com/interfaces/bp20rebadmin'
File rapyd.rb
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class RapydGateway < Gateway
class_attribute :payment_redirect_test, :payment_redirect_live
Identical blocks of code found in 2 locations. Consider refactoring. Open
def add_address(post, options)
if address = options[:billing_address] || options[:address]
post[:address] = address[:address1].to_s
post[:company] = address[:company].to_s
post[:phone] = address[:phone].to_s
- 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 140.
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[:address] = address[:address1].to_s
post[:company] = address[:company].to_s
post[:phone] = address[:phone].to_s
- 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 140.
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 barclaycard_smartpay.rb
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class BarclaycardSmartpayGateway < Gateway
self.test_url = 'https://pal-test.barclaycardsmartpay.com/pal/servlet'
self.live_url = 'https://pal-live.barclaycardsmartpay.com/pal/servlet'
File card_stream.rb
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class CardStreamGateway < Gateway
THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE = 'Specifying the :threeDSRequired initialization option is deprecated. Please use the `:threeds_required => true` *transaction* option instead.'
File decidir.rb
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class DecidirGateway < Gateway
self.test_url = 'https://developers.decidir.com/api/v2'
self.live_url = 'https://live.decidir.com/api/v2'
Class CecabankJsonGateway
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class CecabankJsonGateway < Gateway
include CecabankCommon
CECA_ACTIONS_DICTIONARY = {
purchase: :REST_AUTORIZACION,
Class ForteGateway
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class ForteGateway < Gateway
include Empty
self.test_url = 'https://sandbox.forte.net/api/v2'
self.live_url = 'https://api.forte.net/v2'
Class VancoGateway
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class VancoGateway < Gateway
include Empty
self.test_url = 'https://uat.vancopayments.com/cgi-bin/ws2.vps'
self.live_url = 'https://myvanco.vancopayments.com/cgi-bin/ws2.vps'