Showing 1,478 of 1,478 total issues
Class PinGateway
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class PinGateway < Gateway
self.test_url = 'https://test-api.pinpayments.com/1'
self.live_url = 'https://api.pinpayments.com/1'
self.default_currency = 'AUD'
Class EwayRapidGateway
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class EwayRapidGateway < Gateway
self.test_url = 'https://api.sandbox.ewaypayments.com/'
self.live_url = 'https://api.ewaypayments.com/'
self.money_format = :cents
Class HiPayGateway
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class HiPayGateway < Gateway
# to add more check => payment_product_list: https://developer.hipay.com/api-explorer/api-online-payments#/payments/generateHostedPaymentPage
PAYMENT_PRODUCT = {
'visa' => 'visa',
'master' => 'mastercard'
Class SkipJackGateway
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class SkipJackGateway < Gateway
API_VERSION = '?.?'
self.live_url = 'https://www.skipjackic.com'
self.test_url = 'https://developer.skipjackic.com'
Class DecidirGateway
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class DecidirGateway < Gateway
self.test_url = 'https://developers.decidir.com/api/v2'
self.live_url = 'https://live.decidir.com/api/v2'
self.supported_countries = ['AR']
Class SmartPs
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class SmartPs < Gateway #:nodoc:
##
# This is the base gateway for processors who use the smartPS processing system
self.abstract_class = true
Class TelrGateway
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class TelrGateway < Gateway
self.display_name = 'Telr'
self.homepage_url = 'http://www.telr.com/'
self.live_url = 'https://secure.telr.com/gateway/remote.xml'
Method transaction_hash
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transaction_hash(result)
unless result.success?
return { 'processor_response_code' => response_code_from_result(result),
'additional_processor_response' => additional_processor_response_from_result(result),
'payment_instrument_type' => payment_instrument_type(result.transaction),
Method build_request
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def build_request(action)
xml = Builder::XmlMarkup.new(encoding: 'UTF-8')
xml.instruct!(:xml, encoding: 'UTF-8')
xml.SOAP :Envelope, {
'xmlns:SOAP' => 'http://schemas.xmlsoap.org/soap/envelope/',
- 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_external_mpi_fields
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def add_external_mpi_fields(data, options)
return unless options[:three_d_secure]
if options[:three_d_secure][:version] == THREE_DS_V2
data[:threeDSServerTransID] = options[:three_d_secure][:three_ds_server_trans_id] if options[:three_d_secure][:three_ds_server_trans_id]
- 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_cim
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def parse_cim(body, options)
response = {}
doc = Nokogiri::XML(body).remove_namespaces!
- 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_address
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def add_billing_address(post, options)
if (address = (options[:billing_address] || options[:address]))
post[:billing_address] = {}
post[:billing_address][:street1] = address[:address1] if address[:address1]
post[:billing_address][:street2] = address[:address2] if address[:address2]
- 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_purchases_data
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def add_purchases_data(params, options)
return unless options[:purchases]
params['purchases'] = []
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
RESPONSE_TEXTS = {
0 => 'Transaction Approved',
400 => 'Cancellation Accepted',
481 => 'Cancellation Accepted',
500 => 'Reconciliation Accepted',
- 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 128.
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
RESPONSE_TEXTS = {
0 => 'Transaction Approved',
400 => 'Cancellation Accepted',
481 => 'Cancellation Accepted',
500 => 'Reconciliation Accepted',
- 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 128.
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 country.rb
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
class InvalidCountryCodeError < StandardError
end
class CountryCodeFormatError < StandardError
Class VisanetPeruGateway
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class VisanetPeruGateway < Gateway
include Empty
self.display_name = 'VisaNet Peru Gateway'
self.homepage_url = 'http://www.visanet.com.pe'
Class MercuryGateway
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class MercuryGateway < Gateway
URLS = {
test: 'https://w1.mercurycert.net/ws/ws.asmx',
live: 'https://w1.mercurypay.com/ws/ws.asmx'
}
Class XpayGateway
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class XpayGateway < Gateway
self.display_name = 'XPay Gateway'
self.homepage_url = 'https://developer.nexi.it/en'
self.test_url = 'https://xpaysandbox.nexigroup.com/api/phoenix-0.0/psp/api/v1/'
Class OmiseGateway
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class OmiseGateway < Gateway
API_URL = 'https://api.omise.co/'
VAULT_URL = 'https://vault.omise.co/'
STANDARD_ERROR_CODE_MAPPING = {