Showing 56 of 56 total issues
File realex_offsite.rb
has 725 lines of code (exceeds 250 allowed). Consider refactoring. Open
module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module RealexOffsite
mattr_accessor :production_url
mattr_accessor :test_url
Class Notification
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class Notification < OffsitePayments::Notification
def unescape(val) #:nodoc:
if val
CGI::unescape val
Class Notification
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Notification < OffsitePayments::Notification
def complete?
status == 'Completed'
end
Class Notification
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Notification < OffsitePayments::Notification
def initialize(post, options = {})
super(post, options)
@merchant_id = options[:credential1]
@secret_key = options[:credential2]
Class Notification
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Notification < OffsitePayments::Notification
self.production_ips = [
'78.108.178.206',
'79.137.235.129',
'95.163.96.79',
Class Notification
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Notification < OffsitePayments::Notification
include ActiveUtils::PostsData
include ActiveUtils::RequiresParameters
def initialize(query_string, options={})
File sage_pay_form.rb
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module SagePayForm
mattr_accessor :production_url
mattr_accessor :test_url
Class Notification
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Notification < OffsitePayments::Notification
def complete?
status == 'Completed'
end
Class Notification
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Notification < OffsitePayments::Notification
include Common
def initialize(post, options={})
super
@secret = options[:credential3]
Class Notification
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Notification < OffsitePayments::Notification
class CryptError < StandardError; end
include Encryption
Class Notification
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Notification < OffsitePayments::Notification
def initialize(post, options = {})
super(post, options)
@secret_key = options[:credential2]
end
Method generate_md5string
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def generate_md5string
fields = [@fields["pmt_action"], @fields["pmt_version"]]
fields += [@fields["pmt_selleriban"]] unless @fields["pmt_selleriban"].nil?
fields += [@fields["pmt_id"], @fields["pmt_orderid"], @fields["pmt_reference"], @fields["pmt_duedate"],
@fields["pmt_amount"], @fields["pmt_currency"], @fields["pmt_okreturn"], @fields["pmt_errorreturn"], @fields["pmt_cancelreturn"],
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
class Notification < OffsitePayments::Notification
def initialize(post_arguments, options = {})
super
raise ArgumentError, "The transaction_id needs to be included in the query string." if transaction_id.nil?
- 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 97.
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
class Notification < OffsitePayments::Notification
def initialize(post_arguments, options = {})
super
raise ArgumentError, "The transaction_id needs to be included in the query string." if transaction_id.nil?
- 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 97.
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 authorize_net_sim.rb
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module AuthorizeNetSim
# Overwrite this if you want to change the ANS test url
mattr_accessor :test_url
Class Notification
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Notification < OffsitePayments::Notification
def initialize(*args)
super
@signature = params.delete('pg_sig')
end
Method verify_response
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def verify_response(params, secret)
logstr = ''
params.each { |key, value|
logstr += "#{key} #{value}\n"
}
- 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 wirecard_checkout_page.rb
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
module OffsitePayments #:nodoc:
module Integrations #:nodoc:
# Shop System Plugins - Terms of use
#
# This terms of use regulates warranty and liability between Wirecard Central Eastern Europe (subsequently referred to as WDCEE) and it's
File direc_pay.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module DirecPay
mattr_accessor :production_url, :test_url
Method shipping_address
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def shipping_address(params = {})
# Get the country code in the correct format
# Use what we were given if we can't find anything
country_code = lookup_country_code(params.delete(:country))
add_field(mappings[:shipping_address][:country], country_code)
- 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"