kaiwren/wrest

View on GitHub

Showing 12 of 21 total issues

Class HashWithIndifferentAccess has 43 methods (exceeds 20 allowed). Consider refactoring.
Open

  class HashWithIndifferentAccess < Hash
    # Returns +true+ so that <tt>Array#extract_options!</tt> finds members of
    # this class.
    def extractable_options?
      true
Severity: Minor
Found in lib/wrest/hash_with_indifferent_access.rb - About 5 hrs to fix

    Class Response has 34 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Response
          attr_reader :http_response
          attr_accessor :deserialised_body
    
          include HttpCodes
    Severity: Minor
    Found in lib/wrest/native/response.rb - About 4 hrs to fix

      Class Uri has 34 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Uri
          attr_reader :uri, :username, :password, :uri_string, :uri_path, :query, :default_headers
      
          # Valid tuples for the options are:
          #   :asynchronous_backend => Can currently be set to either Wrest::AsyncRequest::EventMachineBackend.new
      Severity: Minor
      Found in lib/wrest/uri.rb - About 4 hrs to fix

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

            def initialize(constructor = nil)
              if constructor.respond_to?(:to_hash)
                super()
                update(constructor)
        
        
        Severity: Minor
        Found in lib/wrest/hash_with_indifferent_access.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 build_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def build_request(request_klass, uri, parameters, headers)
                if uri.query.empty?
                  request_klass.new(parameters.empty? ? uri.uri_path.to_s : "#{uri.uri_path}?#{Utils.hash_to_param(parameters)}", headers)
                else
                  request_klass.new(
        Severity: Minor
        Found in lib/wrest/native/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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def initialize(wrest_uri, http_request_klass, parameters = {}, body = nil, headers = {}, options = {}) # rubocop:disable Metrics/ParameterLists
        Severity: Minor
        Found in lib/wrest/native/request.rb - About 45 mins to fix

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

                      def to_hash(hash = {})
                        node_hash = {}
          
                        # Insert node hash into parent hash correctly.
                        case hash[name]
          Severity: Minor
          Found in lib/wrest/components/translators/xml/conversions.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def initialize(wrest_uri, body = '', headers = {}, parameters = {}, options = {})
          Severity: Minor
          Found in lib/wrest/native/post.rb - About 35 mins to fix

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

                  def initialize(wrest_uri, body = '', headers = {}, parameters = {}, options = {})
            Severity: Minor
            Found in lib/wrest/native/patch.rb - About 35 mins to fix

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

                    def initialize(wrest_uri, body = '', headers = {}, parameters = {}, options = {})
              Severity: Minor
              Found in lib/wrest/native/put.rb - About 35 mins to fix

                Method update_with_single_argument has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def update_with_single_argument(other_hash, block)
                      if other_hash.is_a? HashWithIndifferentAccess
                        regular_update(other_hash, &block)
                      else
                        other_hash.to_hash.each_pair do |key, value|
                Severity: Minor
                Found in lib/wrest/hash_with_indifferent_access.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 deserialise has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                        def deserialise(response, options = {})
                          data = response.body
                          data = StringIO.new(data || '') unless data.respond_to?(:read)
                          return {} if data.eof?
                
                
                Severity: Minor
                Found in lib/wrest/components/translators/xml.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