lib/active_merchant/billing/gateways/cardprocess.rb
Class CardprocessGateway
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class CardprocessGateway < Gateway
self.test_url = 'https://test.vr-pay-ecommerce.de/v1/payments'
self.live_url = 'https://vr-pay-ecommerce.de/v1/payments'
self.supported_countries = %w[ BE BG CZ DK DE EE IE ES FR HR IT CY LV LT LU
Method error_code_from
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def error_code_from(response)
unless success_from(response)
case response['result']['code']
when '100.100.101'
STANDARD_ERROR_CODE[:incorrect_number]
Method hashify_address
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def hashify_address(address)
hash = {}
hash[:street1] = address[:address1] if address[:address1]
hash[:street2] = address[:address2] if address[:address2]
hash[:city] = address[:city] if address[:city]
- 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"