Showing 105 of 156 total issues
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(code, parent_resource, relationship, resource_ids, options = {})
Method concat_table_field
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def concat_table_field(table, field, quoted = false)
if table.blank? || field.to_s.include?('.')
# :nocov:
if quoted
quote(field)
- 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 links_page_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def links_page_params(options = {})
record_count = options[:record_count]
page_count = calculate_page_count(record_count)
links_page_params = {}
- 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 apply_single_sort
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def apply_single_sort(records, field, direction, options)
context = options[:context]
strategy = _allowed_sort.fetch(field.to_sym, {})[:apply]
- 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 apply_join
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def apply_join(records:, relationship:, resource_type:, join_type:, options:)
if relationship.polymorphic? && relationship.belongs_to?
case join_type
when :inner
records = records.joins(resource_type.to_s.singularize.to_sym)
- 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 relationships_related_link
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def relationships_related_link(source, relationship, query_params = {})
if relationship._routed
url = "#{ self_link(source) }/#{ route_for_relationship(relationship) }"
url = "#{ url }?#{ query_params.to_query }" if query_params.present?
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 alias_table_field
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def alias_table_field(table, field, quoted = false)
if table.blank? || field.to_s.include?('.')
# :nocov:
if quoted
quote(field)
- 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 update_with_overrides
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_with_overrides(error_object_overrides)
@title = error_object_overrides[:title] || @title
@detail = error_object_overrides[:detail] || @detail
@id = error_object_overrides[:id] || @id
@href = error_object_overrides[:href] || href
- 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 parse_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_params(resource_klass, params, allowed_fields)
verify_permitted_params(params, allowed_fields)
checked_attributes = {}
checked_to_one_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 attribute_to_model_field
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def attribute_to_model_field(attribute)
field_name = if attribute == :_cache_field
_cache_field
else
# Note: this will allow the returning of model attributes without a corresponding
- 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 apply_request_settings_to_records
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def apply_request_settings_to_records(records:,
join_manager: ActiveRelation::JoinManager.new(resource_klass: self),
resource_klass: self,
filters: {},
primary_keys: 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 supplying_relationship_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def supplying_relationship_fields(resource_klass)
@_supplying_relationship_fields.fetch resource_klass do
relationships = Set.new(resource_klass._relationships.keys.map(&:to_sym))
cur = resource_klass
while !cur.root? # do not traverse beyond the first root resource
- 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 on_server_error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_server_error(*args, &callback_block)
callbacks ||= []
if callback_block
callbacks << callback_block
- 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 _replace_to_many_links
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _replace_to_many_links(relationship_type, relationship_key_values, options)
relationship = self.class._relationship(relationship_type)
reflect = reflect_relationship?(relationship, options)
- 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 parse_include_directives
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_include_directives(resource_klass, raw_include)
raw_include ||= ''
included_resources = []
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 setup_update_action
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def setup_update_action(params, resource_klass)
resolve_singleton_id(params, resource_klass)
fields = parse_fields(resource_klass, params[:fields])
include_directives = parse_include_directives(resource_klass, params[:include])
- 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 primary_resources_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def primary_resources_url
if @primary_resource_klass._routed
primary_resources_path = resources_path(primary_resource_klass)
@primary_resources_url_cached ||= "#{ base_url }#{ engine_mount_point }#{ primary_resources_path }"
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 allow_include?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def allow_include?(context = nil)
strategy = if @allow_include.nil?
JSONAPI.configuration.default_allow_include_to_one
else
@allow_include
- 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 supplying_attribute_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def supplying_attribute_fields(resource_klass)
@_supplying_attribute_fields.fetch resource_klass do
attrs = Set.new(resource_klass._attributes.keys.map(&:to_sym))
cur = resource_klass
while !cur.root? # do not traverse beyond the first root resource
- 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 construct_order_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def construct_order_options(sort_params)
sort_params = default_sort if sort_params.blank?
return {} unless sort_params
- 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"