ePages-de/beyond_api-ruby_client

View on GitHub

Showing 7 of 13 total issues

Class Orders has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Orders < Base
    include BeyondApi::Utils

    #
    # A +GET+ request is used to retrieve the active payment processes. There is only one active payment process. See {Show payment process details}[http://docs.beyondshop.cloud/#resources-payment-process-get] for more information about the request and response structure.
Severity: Minor
Found in lib/beyond_api/resources/orders.rb - About 4 hrs to fix

    Class Session has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Session
        class InvalidUriProtocolError < StandardError; end
    
        attr_reader :api_url
        attr_accessor :access_token, :refresh_token
    Severity: Minor
    Found in lib/beyond_api/session.rb - About 2 hrs to fix

      Class Carts has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Carts < Base
          include BeyondApi::Utils
      
          #
          # A +POST+ request is used to add a line item to the cart. Currently only product line items are supported.
      Severity: Minor
      Found in lib/beyond_api/resources/carts.rb - About 2 hrs to fix

        Method upload_by_form has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.upload_by_form(session, path, files, params)
              response = BeyondApi::Connection.multipart.post do |request|
                request.url(session.api_url + path)
                request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil?
                request.options[:params_encoder] = Faraday::FlatParamsEncoder
        Severity: Minor
        Found in lib/beyond_api/request.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 sanitize_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def sanitize_response(hash)
              {}.tap do |h|
                hash.each do |key, value|
                  next if key == "_links" && BeyondApi.configuration.remove_response_links
        
        
        Severity: Minor
        Found in lib/beyond_api/utils.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 upload has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def self.upload(session, path, file_binary, content_type, params)
        Severity: Minor
        Found in lib/beyond_api/request.rb - About 35 mins to fix

          Method handle_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle_response(response, status, respond_with_true: false)
                if status.between?(200, 299)
                  return true if respond_with_true
          
                  response = sanitize_response(response)
          Severity: Minor
          Found in lib/beyond_api/utils.rb - About 35 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