pagseguro/ruby

View on GitHub

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')

Severity: Minor
Found in lib/pagseguro/subscription_change_payment/request_serializer.rb - About 4 hrs to fix

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)
Severity: Minor
Found in lib/pagseguro/transaction_request/request_serializer.rb - About 2 hrs to fix

    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
    Severity: Minor
    Found in lib/pagseguro/authorization_request/request_serializer.rb - About 2 hrs to fix

    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
    Severity: Minor
    Found in lib/pagseguro/subscription/request_serializer.rb - About 2 hrs to fix

    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
    Severity: Minor
    Found in lib/pagseguro/subscription/request_serializer.rb - About 2 hrs to fix

    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
    Severity: Minor
    Found in lib/pagseguro/transaction.rb - About 2 hrs to fix

      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)
      Severity: Minor
      Found in lib/pagseguro/subscription_plan/request_serializer.rb - About 2 hrs to fix

      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
      Severity: Minor
      Found in lib/pagseguro/transaction_request/request_serializer.rb - About 2 hrs to fix

        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')
        
        
        Severity: Minor
        Found in lib/pagseguro/subscription_change_payment/request_serializer.rb - About 1 hr to fix

          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)
          Severity: Minor
          Found in lib/pagseguro/transaction_request/request_serializer.rb - About 1 hr to fix

            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
            Severity: Minor
            Found in lib/pagseguro/subscription/request_serializer.rb - About 1 hr to fix

            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
            Severity: Minor
            Found in lib/pagseguro/authorization_request/request_serializer.rb - About 55 mins to fix

            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]
            Severity: Minor
            Found in lib/pagseguro/subscription/subscription_search.rb - About 55 mins to fix

            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
            Severity: Minor
            Found in lib/pagseguro/authorization_request/request_serializer.rb - About 45 mins to fix

            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)
            Severity: Minor
            Found in lib/pagseguro/transaction_request/request_serializer.rb - About 45 mins to fix

            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={})
            Severity: Minor
            Found in lib/pagseguro/request.rb - About 35 mins to fix

              Method execute has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def execute(request_method, path, api_version, data, headers) # :nodoc:
              Severity: Minor
              Found in lib/pagseguro/request.rb - About 35 mins to fix

                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
                Severity: Minor
                Found in lib/pagseguro/subscription/request_serializer.rb - About 25 mins to fix

                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
                Severity: Minor
                Found in lib/pagseguro/authorization_request/request_serializer.rb - About 25 mins to fix

                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
                Severity: Minor
                Found in lib/pagseguro/authorization_request/request_serializer.rb - About 25 mins to fix

                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

                Severity
                Category
                Status
                Source
                Language