KentaaNL/tikkie-api

View on GitHub

Showing 6 of 13 total issues

Method request has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def request(http_method, path, params = {}, body = {})
        uri = URI.join(config.api_url, path)
        uri.query = URI.encode_www_form(params) unless params.empty?

        logger.debug("[Tikkie] Request: #{http_method.upcase} #{uri}") if ENV['TIKKIE_DEBUG']
Severity: Minor
Found in lib/tikkie/api/request.rb - About 1 hr to fix

    Method list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

              def list(platform_token, user_token, options = {})
                offset = options[:offset] || 0
                limit = options[:limit] || 20
                from_date = options[:from_date]
                to_date = options[:to_date]
    Severity: Minor
    Found in lib/tikkie/api/v1/requests/payment_requests.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 request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def request(http_method, path, params = {}, body = {})
            uri = URI.join(config.api_url, path)
            uri.query = URI.encode_www_form(params) unless params.empty?
    
            logger.debug("[Tikkie] Request: #{http_method.upcase} #{uri}") if ENV['TIKKIE_DEBUG']
    Severity: Minor
    Found in lib/tikkie/api/request.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 load_resource has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            def load_resource
              params = { pageNumber: page_number, pageSize: page_size }
              params[:fromDate] = options[:from_date].respond_to?(:utc) ? options[:from_date].utc.iso8601 : options[:from_date] if options.key?(:from_date)
              params[:toDate] = options[:to_date].respond_to?(:utc) ? options[:to_date].utc.iso8601 : options[:to_date] if options.key?(:to_date)
              params[:includeRefunds] = options[:include_refunds] if options.key?(:include_refunds)
    Severity: Minor
    Found in lib/tikkie/api/resources/payments.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 load_resource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def load_resource
              params = { pageNumber: page_number, pageSize: page_size }
              params[:fromDate] = options[:from_date].respond_to?(:utc) ? options[:from_date].utc.iso8601 : options[:from_date] if options.key?(:from_date)
              params[:toDate] = options[:to_date].respond_to?(:utc) ? options[:to_date].utc.iso8601 : options[:to_date] if options.key?(:to_date)
    
    
    Severity: Minor
    Found in lib/tikkie/api/resources/payment_requests.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 create_resource has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def create_resource(attributes)
              params = { description: attributes.fetch(:description) }
              if attributes.key?(:amount)
                amount = Tikkie::Api::Amount.new(attributes[:amount])
                params[:amountInCents] = amount.to_cents
    Severity: Minor
    Found in lib/tikkie/api/resources/payment_request.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