Showing 105 of 156 total issues
Method show_related_resources
has a Cognitive Complexity of 10 (exceeds 5 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]
- 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 flatten_resource_tree
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def flatten_resource_tree(resource_tree, flattened_tree = {})
resource_tree.fragments.each_pair do |resource_rid, fragment|
resource_klass = resource_rid.resource_klass
id = resource_rid.id
- 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
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(source_resource_klass:, segment_string:, parse_fields: true)
first_part, last_part = segment_string.split('#', 2)
relationship = source_resource_klass._relationship(first_part)
if relationship
- 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_to_one_relationship
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse_to_one_relationship(resource_klass, link_value, relationship)
if link_value.nil?
linkage = nil
else
linkage = link_value[:data]
- 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 check_include
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_include(resource_klass, include_parts)
relationship_name = unformat_key(include_parts.first)
relationship = resource_klass._relationship(relationship_name)
if relationship && format_key(relationship_name) == include_parts.first
- 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 _create_to_many_links
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _create_to_many_links(relationship_type, relationship_key_values, options)
relationship = self.class._relationships[relationship_type]
relation_name = relationship.relation_name(context: @context)
if options[:reflected_source]
- 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_resources_to_tree
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_resources_to_tree(resource_klass,
tree,
resources,
include_related,
source_rid: nil,
Method _create_to_many_links
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _create_to_many_links(relationship_type, relationship_key_values, options)
relationship = self.class._relationships[relationship_type]
relation_name = relationship.relation_name(context: @context)
if options[:reflected_source]
Method links_page_params
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def links_page_params(options = {})
record_count = options[:record_count]
page_count = calculate_page_count(record_count)
links_page_params = {}
Method _save
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _save(validation_context = nil)
unless @model.valid?(validation_context)
fail JSONAPI::Exceptions::ValidationErrors.new(self)
end
- 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_filter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def verify_filter(filter, raw, context = nil)
filter_values = []
if raw.present?
begin
filter_values += raw.is_a?(String) ? CSV.parse_line(raw) : [raw]
- 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 _remove_to_many_link
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _remove_to_many_link(relationship_type, key, options)
relationship = self.class._relationships[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 find
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find
filters = params[:filters]
include_directives = params[:include_directives]
sort_criteria = params[:sort_criteria]
paginator = params[:paginator]
- 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_exceptions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handle_exceptions(e)
case e
when JSONAPI::Exceptions::Error
errors = e.errors
when ActionController::ParameterMissing
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def links_page_params(options = {})
record_count = options[:record_count]
links_page_params = {}
links_page_params['first'] = {
- 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 inherited
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def inherited(subclass)
super
subclass.abstract(false)
subclass.immutable(false)
subclass.caching(_caching)
- 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_update_relationship_operation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_update_relationship_operation(resource_klass, verified_params, relationship, parent_key)
options = {
context: @context,
resource_id: parent_key,
relationship_type: relationship.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 process_path_to_tree
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_path_to_tree(path_segments, resource_klass, default_join_type, default_polymorphic_join_type)
node = {
resource_klasses: {
resource_klass => {
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 contents
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def contents
if has_errors?
return { 'errors' => @global_errors }
else
hash = @serialized_results[0]
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(code, parent_resource, relationship, resource_ids, options = {})