Showing 1,478 of 1,478 total issues
Class CreditcallGateway
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class CreditcallGateway < Gateway
include Empty
self.test_url = 'https://test.cardeasexml.com/generic.cex'
self.live_url = 'https://live.cardeasexml.com/generic.cex'
Class WompiGateway
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class WompiGateway < Gateway
self.test_url = 'https://sync.sandbox.wompi.co/v1'
self.live_url = 'https://sync.production.wompi.co/v1'
self.supported_countries = ['CO']
Class AuthorizeNetArbGateway
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class AuthorizeNetArbGateway < Gateway
API_VERSION = '3.1'
self.test_url = 'https://apitest.authorize.net/xml/v1/request.api'
self.live_url = 'https://api.authorize.net/xml/v1/request.api'
Class PagarmeGateway
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class PagarmeGateway < Gateway
self.live_url = 'https://api.pagar.me/1/'
self.supported_countries = ['BR']
self.default_currency = 'BRL'
Class NetbillingGateway
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class NetbillingGateway < Gateway
self.live_url = self.test_url = 'https://secure.netbilling.com:1402/gw/sas/direct3.1'
TRANSACTIONS = {
authorization: 'A',
File quickbooks.rb
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class QuickbooksGateway < Gateway
self.test_url = 'https://sandbox.api.intuit.com'
self.live_url = 'https://api.intuit.com'
Method add_recipient_data
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def add_recipient_data(post, options)
return unless options[:recipient].is_a?(Hash)
recipient = options[:recipient]
- 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_element
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def parse_element(reply, node)
case node.name
when 'CrossReferenceTransactionResult'
reply[:transaction_result] = {}
node.attributes.each do |a, b|
- 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_for_type
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def add_address_for_type(type, post, payment, address)
prefix = address_key_prefix(type)
first_name, last_name = split_names(address[:name])
post[address_key(prefix, 'fname')] = first_name.blank? && last_name.blank? ? payment.first_name : 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 21 (exceeds 5 allowed). Consider refactoring. Open
def add_address(xml, creditcard, options)
return unless creditcard
if address = options[:billing_address] || options[:address]
xml.tag!('CUSTOMER_BILL') 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
File ebanx.rb
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class EbanxGateway < Gateway
self.test_url = 'https://sandbox.ebanxpay.com/ws/'
self.live_url = 'https://api.ebanxpay.com/ws/'
File pro_pay.rb
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'nokogiri'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class ProPayGateway < Gateway
Similar blocks of code found in 2 locations. Consider refactoring. Open
if address = recipient[:address]
address1 = address[:address1] || address[:address_line1]
address2 = address[:address2] || address[:address_line2]
post[:recipient][:address] = {}
- 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 104.
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
if address = sender[:address]
address1 = address[:address1] || address[:address_line1]
address2 = address[:address2] || address[:address_line2]
post[:sender][:address] = {}
- 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 104.
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 mercury.rb
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
# The Mercury gateway integration by default requires that the Mercury
# account being used has tokenization turned. This enables the use of
# capture/refund/void without having to pass the credit card back in each
Class SecurePayAuGateway
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class SecurePayAuGateway < Gateway
API_VERSION = 'xml-4.2'
PERIODIC_API_VERSION = 'spxml-3.0'
class_attribute :test_periodic_url, :live_periodic_url
Class BorgunGateway
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class BorgunGateway < Gateway
self.display_name = 'Borgun'
self.homepage_url = 'http://www.borgun.com'
self.test_url = 'https://gatewaytest.borgun.is/ws/Heimir.pub.ws:Authorization'
Class GarantiGateway
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class GarantiGateway < Gateway
self.live_url = 'https://sanalposprov.garanti.com.tr/VPServlet'
self.test_url = 'https://sanalposprovtest.garanti.com.tr/VPServlet'
# The countries the gateway supports merchants from as 2 digit ISO country codes
Class PayexGateway
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class PayexGateway < Gateway
class_attribute :live_external_url, :test_external_url, :live_confined_url, :test_confined_url
self.live_external_url = 'https://external.payex.com/'
self.test_external_url = 'https://test-external.payex.com/'
Class PayArcGateway
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class PayArcGateway < Gateway
self.test_url = 'https://testapi.payarc.net/v1'
self.live_url = 'https://api.payarc.net/v1'
self.supported_countries = ['US']