Showing 6 of 6 total issues
Method _include_relation_in_root
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
Open
def _include_relation_in_root(relation, *args)
local_options = args.extract_options!
foreign_key_column = args[0]
constraining_table = args[1]
- 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 _include_relation_in_root
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def _include_relation_in_root(relation, *args)
local_options = args.extract_options!
foreign_key_column = args[0]
constraining_table = args[1]
File array_serializer.rb
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module PostgresExt::Serializers::ActiveModel
module ArraySerializer
def self.prepended(base)
base.send :include, IncludeMethods
end
Method _results_table_arel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def _results_table_arel(singular_key = nil)
tables = []
@_results_tables.each do |key, array|
json_table = array
.map {|t| t.project(Arel.star) }
Method build_json
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def build_json(controller, resource, options)
serializer_instance = super
return serializer_instance unless serializer_instance
default_options = controller.send(:default_serializer_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 _process_has_many_relation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _process_has_many_relation(key, embed_key, association_reflection, relation_query, ids_table_arel)