Showing 103 of 103 total issues
Method pluck_attributes_and_relationships
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def pluck_attributes_and_relationships(record, rels)
cleaned = { id: record['id'] }
relationships = Hash[rels.map { |rel| [rel, singular?(rel)] }]
relationships.each do |rel_name, is_singular|
- 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 handle_hal_links_embedded
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def handle_hal_links_embedded(object, attributes)
attributes["_links"] = attributes[:_links] if attributes[:_links]
attributes["_embedded"] = attributes[:_embedded] if attributes[:_embedded]
if attributes["_links"]
attributes["_links"].each do |key, value|
- 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 username
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def username(value = nil, &block)
@username ||= nil
@@username ||= nil
if value.nil?
if block_given?
- 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 generate_new_object
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_new_object(options={})
if @response.body.is_a?(Array) || @response.body.is_a?(Hash)
body = @response.body
elsif is_json_response?
begin
Method fetch_attributes_and_relationships
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def fetch_attributes_and_relationships(record, included, rels, base: nil)
base = Array(base) unless base.is_a?(Array)
rels = rels - [base.last]
rels_object = record['relationships']
- 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 _callback_request
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _callback_request(type, name, param)
_handle_super_class_callbacks(type, name, param)
@before_callbacks ||= []
@after_callbacks ||= []
callbacks = (type == :before ? @before_callbacks : @after_callbacks)
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
def initialize(name, value, request, options = {})
@name = name
class_to_map = request.method[:options][:lazy][name] rescue nil
@request = class_to_map.nil? ? request : Flexirest::Request.new(class_to_map._mapped_method(:find), class_to_map.new, options)
@object = nil
- 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 password
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def password(value = nil, &block)
if value.nil?
if block_given?
@password = block
else
- 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 prepare_url
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def prepare_url
missing = []
if @forced_url && @forced_url.present?
@url = @forced_url
else
- 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 base_url
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def base_url(value = nil)
@base_url ||= nil
@@base_url ||= nil
if value.nil?
value = if @base_url.nil?
- 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 set_corresponding_value
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_corresponding_value(value, key = nil, object = nil, overridden_name = nil)
optional_args = [key, object, overridden_name]
value_from_object = optional_args.all? # trying to parse a JSON Hash value
value_from_other_type = optional_args.none? # trying to parse anything else
raise Flexirest::InvalidArgumentsException.new("Optional args need all to be filled or none") unless value_from_object || value_from_other_type
Method request_body_type
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def request_body_type(value = nil)
@request_body_type ||= nil
if value.nil?
if @request_body_type.nil?
if value.nil? && superclass.respond_to?(:request_body_type)
- 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 alias_type
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def alias_type(value = nil)
@alias_type ||= nil
if value.nil?
if @alias_type.nil?
if value.nil? && superclass.respond_to?(:alias_type)
- 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 new_object
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def new_object(attributes, name = nil, parent = nil, parent_attribute_name = nil)
@method[:options][:has_many] ||= {}
name = name.to_sym rescue nil
if @method[:options][:has_many][name]
parent_name = name
- 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 hal_response?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def hal_response?
_, content_type = @response.response_headers.detect{|k,v| k.downcase == "content-type"}
faked_response = @response.response_headers.detect{|k,v| k.downcase == "x-arc-faked-response"}
if content_type && content_type.respond_to?(:each)
content_type.each do |ct|
- 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 disable_automatic_date_parsing
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def disable_automatic_date_parsing(value = nil)
@disable_automatic_date_parsing ||= nil
if value.nil?
if @disable_automatic_date_parsing.nil?
if value.nil? && superclass.respond_to?(:disable_automatic_date_parsing)
- 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 pluck_attributes_and_relationships
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pluck_attributes_and_relationships(record, rels)
cleaned = { id: record['id'] }
relationships = Hash[rels.map { |rel| [rel, singular?(rel)] }]
relationships.each do |rel_name, is_singular|
Method method_missing
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def method_missing(name, *args)
if name.to_s[-1,1] == "="
name = name.to_s.chop.to_sym
_set_attribute(name, args.first)
else
Method inspect
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def inspect
inspection = if @attributes.any?
@attributes.collect { |key, value|
"#{key}: #{value_for_inspect(value)}"
}.compact.join(", ")
- 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 basic_auth_method
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def basic_auth_method(value = nil)
if value.nil? # Used as a getter method
if @basic_auth_method.nil? && superclass.respond_to?(:basic_auth_method)
superclass.basic_auth_method
else
- 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"