Showing 105 of 156 total issues
Method parse_fields
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def parse_fields(resource_klass, fields)
extracted_fields = {}
return extracted_fields if fields.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 verify_key
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def verify_key(key, context = nil)
key_type = resource_key_type
case key_type
when :integer
- 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 find_related_monomorphic_fragments
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def find_related_monomorphic_fragments(source_fragments, relationship, options, connect_source_identity)
filters = options.fetch(:filters, {})
source_ids = source_fragments.collect {|item| item.identity.id}
include_directives = options.fetch(:include_directives, {})
- 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 perform_joins
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def perform_joins(records, options)
join_array = flatten_join_tree_by_depth
join_array.each do |level_joins|
level_joins.each do |join_details|
- 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
Class Processor
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Processor
include Callbacks
define_jsonapi_resources_callbacks :find,
:show,
:show_relationship,
Method attribute
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def attribute(attribute_name, options = {})
_clear_cached_attribute_options
_clear_fields_cache
attr = attribute_name.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 find_fragments
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def find_fragments(filters, options = {})
include_directives = options.fetch(:include_directives, {})
resource_klass = self
fragments = {}
- 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
File acts_as_resource_controller.rb
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'csv'
module JSONAPI
module ActsAsResourceController
MEDIA_TYPE_MATCHER = /.+".+"[^,]*|[^,]+/
Method verify_permitted_params
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def verify_permitted_params(params, allowed_fields)
formatted_allowed_fields = allowed_fields.collect { |field| format_key(field).to_sym }
params_not_allowed = []
params.each do |key, value|
Method update_links
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def update_links(serializer, result)
@top_level_links.merge!(result.links)
# Build pagination links
if result.is_a?(JSONAPI::ResourceSetOperationResult) ||
- 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 show_related_resources
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show_related_resources
source_klass = params[:source_klass]
source_id = params[:source_id]
relationship_type = params[:relationship_type]
filters = params[:filters]
Method add_resources_to_tree
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def add_resources_to_tree(resource_klass,
tree,
resources,
include_related,
source_rid: 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 jsonapi_resources
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def jsonapi_resources(*resources, &_block)
@resource_type = resources.first
res = JSONAPI::Resource.resource_klass_for(resource_type_with_module_prefix(@resource_type))
res._routed = true
Method parse_fields
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_fields(resource_klass, fields)
extracted_fields = {}
return extracted_fields if fields.nil?
Method relationships_hash
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def relationships_hash(source, fetchable_fields, relationship_data)
relationships = source.class._relationships.select{|k,_v| fetchable_fields.include?(k) }
field_set = supplying_relationship_fields(source.class) & relationships.keys
relationships.each_with_object({}) do |(name, relationship), hash|
- 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 jsonapi_links
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def jsonapi_links(*links)
link_type = links.first
formatted_relationship_name = format_route(link_type)
options = links.extract_options!.dup
- 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_pagination_params
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_pagination_params(params)
if params.nil?
@offset = 0
@limit = JSONAPI.configuration.default_page_size
elsif params.is_a?(ActionController::Parameters)
- 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_pagination_params
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_pagination_params(params)
if params.nil?
@number = 1
@size = JSONAPI.configuration.default_page_size
elsif params.is_a?(ActionController::Parameters)
- 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_filters
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_filters(resource_klass, filters)
parsed_filters = {}
# apply default filters
resource_klass._allowed_filters.each do |filter, opts|
- 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 jsonapi_resource
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def jsonapi_resource(*resources, &_block)
@resource_type = resources.first
res = JSONAPI::Resource.resource_klass_for(resource_type_with_module_prefix(@resource_type))
res._routed = true