pezra/hal-client

View on GitHub

Showing 9 of 9 total issues

Class Representation has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Representation
    extend Forwardable

    NO_RELATED_RESOURCE = ->(link_rel) {
      raise KeyError, "No resources are related via `#{link_rel}`"
Severity: Minor
Found in lib/hal_client/representation.rb - About 3 hrs to fix

    Class HalClient has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class HalClient
      autoload :Interpreter, 'hal_client/interpreter'
      autoload :Representation, 'hal_client/representation'
      autoload :RepresentationFuture, 'hal_client/representation_future'
      autoload :RepresentationSet, 'hal_client/representation_set'
    Severity: Minor
    Found in lib/hal_client.rb - About 2 hrs to fix

      Method retryable has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def retryable(&block)
            current_try = 1
      
            loop do
              begin
      Severity: Minor
      Found in lib/hal_client/retryinator.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def initialize(options={})
          @default_message_request_headers = HTTP::Headers.new
          @default_entity_request_headers = HTTP::Headers.new
          @auth_helper = as_callable(options.fetch(:authorization, NullAuthHelper))
          @base_client ||= options[:base_client]
      Severity: Minor
      Found in lib/hal_client.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 interpret_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def interpret_response(resp)
          case resp.status
          when 200...300
            location = resp.headers["Location"]
      
      
      Severity: Minor
      Found in lib/hal_client.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

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

          def add_link(rel, target, opts={})
            raise ArgumentError, "target must not be nil or empty" if target.nil? || target.empty?
            templated = opts.fetch(:templated, false)
      
            new_link =
      Severity: Minor
      Found in lib/hal_client/representation_editor.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

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

          def build_direct_link(rel, info)
            fail InvalidRepresentationError unless hashish?(info)
      
            target_url = info.fetch("href") { fail InvalidRepresentationError }
            return nil unless target_url
      Severity: Minor
      Found in lib/hal_client/interpreter.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

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

          def def_unsafe_request(method)
            verb = method.to_s.upcase
      
            define_method(method) do |url, data, headers={}|
              headers = auth_headers(url).merge(headers)
      Severity: Minor
      Found in lib/hal_client.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 def_idempotent_unsafe_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def def_idempotent_unsafe_request(method)
            verb = method.to_s.upcase
      
            define_method(method) do |url, data, headers={}|
              headers = auth_headers(url).merge(headers)
      Severity: Minor
      Found in lib/hal_client.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