Showing 14 of 14 total issues
Method def_one_to_many
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
def def_one_to_many(opts)
one_to_one = opts[:type] == :one_to_one
name = opts[:name]
model = self
key = (opts[:key] ||= opts.default_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
File dao.rb
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'sequel_dm/extensions/select_fields'
SequelDM::DAO = Class.new(Sequel::Model)
module SequelDM
def self.DAO(source)
Class DAO
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class DAO
class_attribute :mapper
dataset_module do
include SequelDM::Extensions::SelectFields
Method def_one_to_many
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
def def_one_to_many(opts)
one_to_one = opts[:type] == :one_to_one
name = opts[:name]
model = self
key = (opts[:key] ||= opts.default_key)
Method select_fields
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def select_fields(fields)
if fields.empty?
if !model.association_reflections.empty?
eager(model.association_reflections.keys)
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 delete_dissapeared_children
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def delete_dissapeared_children(entity, association, options)
association_dao = options[:class]
unless options[:key]
raise ArgumentError, "key option should be specified for #{association}"
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 delete_dissapeared_children
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delete_dissapeared_children(entity, association, options)
association_dao = options[:class]
unless options[:key]
raise ArgumentError, "key option should be specified for #{association}"
end
Method insert_or_update_associations
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def insert_or_update_associations(entity)
unless association_reflections.empty?
association_reflections.each do |association_name, options|
if options[:if] && !options[:if].call(entity)
next
- 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 delete_associations
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def delete_associations(entity)
unless association_reflections.empty?
association_reflections.each do |association, options|
if options[:if] && !options[:if].call(entity)
next
- 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 insert_associations
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def insert_associations(entity)
unless association_reflections.empty?
association_reflections.each do |association_name, options|
if options[:if] && !options[:if].call(entity)
next
- 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 prepare_key_condition_from_entity
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def prepare_key_condition_from_entity(entity)
key_condition = {}
if primary_key.is_a?(Array)
primary_key.each do |key_part|
key_part_value = entity.send(key_part)
- 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 select_fields
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select_fields(fields)
if fields.empty?
if !model.association_reflections.empty?
eager(model.association_reflections.keys)
else
Method column
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def column(column_name, options = {})
SequelDM::ArgsValidator.is_symbol!(column_name, :column_name)
SequelDM::ArgsValidator.is_hash!(options, :column_options)
SequelDM::ArgsValidator.is_symbol!(options[:to], :to) if options[:to]
SequelDM::ArgsValidator.is_proc!(options[:load], :load) if options[:load]
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(column_name, entity_field, load = nil, dump = nil, set_field = true, set_column = true)