Showing 22 of 60 total issues
Method build
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def build
Nokogiri::XML::Builder.new(encoding: PagSeguro.encoding) do |xml|
xml.send(:paymentMethod) {
xml.send(:type, 'CREDITCARD')
- 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
Class RequestSerializer
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class RequestSerializer
# The transaction request that will be serialized.
attr_reader :transaction_request
def initialize(transaction_request)
Method serialize_address
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def serialize_address(xml, address)
return unless address
xml.send(:address) {
xml.send(:postalCode, address.postal_code) if address.postal_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"
Further reading
Method serialize_address
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def serialize_address(xml, address)
return unless address
xml.send(:address) {
xml.send(:street, address.street) if address.street
- 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 serialize_billing_address
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def serialize_billing_address(xml, address)
return unless address
xml.send(:billingAddress) {
xml.send(:street, address.street) if address.street
- 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
Class Transaction
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Transaction
ONE_DAY_IN_SECONDS = 86400
FIFTEEN_MINUTES_IN_SECONDS = 900
include Extensions::MassAssignment
Method xml_builder
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def xml_builder
Nokogiri::XML::Builder.new(encoding: PagSeguro.encoding) do |xml|
xml.send(:preApprovalRequest) {
xml.send(:redirectURL, object.redirect_url)
xml.send(:reviewURL, object.review_url)
- 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 request_serializer.rb
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
module PagSeguro
class TransactionRequest
class RequestSerializer
# The transaction request that will be serialized.
attr_reader :transaction_request
Method build
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build
Nokogiri::XML::Builder.new(encoding: PagSeguro.encoding) do |xml|
xml.send(:paymentMethod) {
xml.send(:type, 'CREDITCARD')
Method xml_serialize_credit_card
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def xml_serialize_credit_card(xml)
return unless transaction_request.is_a?(PagSeguro::CreditCardTransactionRequest)
xml.send(:creditCard) do
xml.send(:token, transaction_request.credit_card_token)
Method serialize_sender
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def serialize_sender(xml, sender)
return unless sender
xml.send(:sender) {
xml.send(:name, sender.name) if sender.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 serialize_account
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def serialize_account(xml, account)
return unless account
xml.send(:account) {
xml.send(:email, account.email) if account.email
- 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 params
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def params
{}.tap do |param|
param[:credentials] = options[:credentials]
param[:page] = page unless page.zero?
param[:maxPageResults] = options[:per_page]
- 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 serialize_company
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def serialize_company(xml, company)
return unless company
xml.send(:company) {
xml.send(:name, company.name) if company.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 xml_serialize_credit_card
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def xml_serialize_credit_card(xml)
return unless transaction_request.is_a?(PagSeguro::CreditCardTransactionRequest)
xml.send(:creditCard) do
xml.send(:token, transaction_request.credit_card_token)
- 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 post_xml
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def post_xml(path, api_version, credentials, data = '', options={})
Method execute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def execute(request_method, path, api_version, data, headers) # :nodoc:
Method build
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build
Nokogiri::XML::Builder.new(encoding: PagSeguro.encoding) do |xml|
xml.send(:directPreApproval) {
xml.send(:plan, object.plan) if object.plan
xml.send(:reference, object.reference) if object.reference
- 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 serialize_person
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def serialize_person(xml, person)
return unless person
xml.send(:person) {
xml.send(:name, person.name) if person.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 serialize_partner
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def serialize_partner(xml, partner)
return unless partner
xml.send(:partner) {
xml.send(:name, partner.name) if partner.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"