Showing 156 of 156 total issues
Class BasicResource
has 136 methods (exceeds 20 allowed). Consider refactoring. Open
class BasicResource
include Callbacks
@abstract = true
@immutable = true
File basic_resource.rb
has 863 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'jsonapi/callbacks'
require 'jsonapi/configuration'
module JSONAPI
class BasicResource
File active_relation_resource.rb
has 620 lines of code (exceeds 250 allowed). Consider refactoring. Open
module JSONAPI
class ActiveRelationResource < BasicResource
root_resource
def find_related_ids(relationship, options = {})
File request.rb
has 614 lines of code (exceeds 250 allowed). Consider refactoring. Open
module JSONAPI
class Request
attr_accessor :fields, :include, :filters, :sort_criteria, :errors, :controller_module_path,
:context, :paginator, :source_klass, :source_id,
:include_directives, :params, :warnings, :server_error_callbacks, :operations
File exceptions.rb
has 502 lines of code (exceeds 250 allowed). Consider refactoring. Open
module JSONAPI
module Exceptions
class Error < RuntimeError
attr_reader :error_object_overrides
Method jsonapi_resources
has a Cognitive Complexity of 48 (exceeds 5 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
- 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 a Cognitive Complexity of 46 (exceeds 5 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
- 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_polymorphic_fragments
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_related_polymorphic_fragments(source_fragments, relationship, options, connect_source_identity)
filters = options.fetch(:filters, {})
source_ids = source_fragments.collect {|item| item.identity.id}
resource_klass = relationship.resource_klass
Method find_related_polymorphic_fragments
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def find_related_polymorphic_fragments(source_fragments, relationship, options, connect_source_identity)
filters = options.fetch(:filters, {})
source_ids = source_fragments.collect {|item| item.identity.id}
resource_klass = relationship.resource_klass
- 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 ActiveRelationResource
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class ActiveRelationResource < BasicResource
root_resource
def find_related_ids(relationship, options = {})
self.class.find_related_fragments([self], relationship.name, options).keys.collect { |rid| rid.id }
Class Request
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Request
attr_accessor :fields, :include, :filters, :sort_criteria, :errors, :controller_module_path,
:context, :paginator, :source_klass, :source_id,
:include_directives, :params, :warnings, :server_error_callbacks, :operations
Method populate!
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def populate!(serializer, context, options)
return if @populated
# For each resource klass we want to generate the caching key
- 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 object_hash
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def object_hash(source, relationship_data)
obj_hash = {}
return obj_hash if source.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 find_related_monomorphic_fragments
has 96 lines of code (exceeds 25 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, {})
Class ResourceSerializer
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class ResourceSerializer
attr_reader :link_builder, :key_formatter, :serialization_options,
:fields, :include_directives, :always_include_to_one_linkage_data,
:always_include_to_many_linkage_data, :options
File processor.rb
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
module JSONAPI
class Processor
include Callbacks
define_jsonapi_resources_callbacks :find,
:show,
Method verify_permitted_params
has a Cognitive Complexity of 24 (exceeds 5 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|
- 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 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_fragments(filters, options = {})
include_directives = options.fetch(:include_directives, {})
resource_klass = self
fragments = {}
File resource_serializer.rb
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
module JSONAPI
class ResourceSerializer
attr_reader :link_builder, :key_formatter, :serialization_options,
:fields, :include_directives, :always_include_to_one_linkage_data,
Method populate!
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def populate!(serializer, context, options)
return if @populated
# For each resource klass we want to generate the caching key