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}`"
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'
Method retryable
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def retryable(&block)
current_try = 1
loop do
begin
- Read upRead up
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]
- Read upRead up
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"]
- Read upRead up
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 =
- Read upRead up
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
- Read upRead up
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)
- Read upRead up
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)
- Read upRead up
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"