Showing 18 of 18 total issues
Method read
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def read
if @options.batch_size.nil?
return @reader.read @options.description
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 []=
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def []=(key, value)
raise Orel::ReadonlyError if @readonly
if key.is_a?(Orel::Relation)
klass = 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 find_by_key
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_by_key(key_name, *args)
key = @heading.get_key(key_name) or raise ArgumentError, "Key #{key_name.inspect} does not exist"
if args.first.is_a?(Hash)
raise ArgumentError, "Extraneous args to #find_by_key: #{args.inspect}" if args.size > 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 read
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read
if @options.batch_size.nil?
return @reader.read @options.description
end
Method get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get(name)
unless @associations[name]
# If a lock is set on this object, disallow any new relationships
# to be instanciated.
raise Orel::LockedForQueryError if @locked_for_query
- 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 extract_objects_with_joins
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_objects_with_joins(projected_joins, rows)
objects = []
objects_hash = {}
rows.each(:as => :hash) { |row|
Method _apply!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _apply!
# Get the source of the block as a string and split it into a series of identifiers.
source = @block.to_source(:strip_enclosure => true)
source.gsub!(@syntax[0], '')
identifiers = source.split(@syntax[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 initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(join_id, klass, heading, table, join_class, join_heading, join_table)
Method create_foreign_key_relationship!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_foreign_key_relationship!
# Default on_delete to restrict.
unless @on_delete
@on_delete = Orel::Relation::Cascade::RESTRICT
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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(klass, heading, connection, query, select_manager, description)
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(parent_class, parent_heading_name, parent_key_name, child_class, child_heading_name, child_key_name)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(parent_table, parent_attributes, child_table, child_attributes, cascade)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(klass, set, namer, child_name=nil, &block)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(options, reader, heading, manager, table)
Method extract_objects_with_joins
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def extract_objects_with_joins(projected_joins, rows)
objects = []
objects_hash = {}
rows.each(:as => :hash) { |row|
- 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 valid?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def valid?
@errors = new_errors
@heading.attributes.each { |attribute|
unless @object.persisted?
next if attribute.domain.is_a?(Orel::Domains::Serial)
- 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 []
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def [](key)
case key
when Class
klass = key
heading = key.get_heading
- 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_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_options(klass)
options = {}
# klass.parents is provided by ActiveSupport.
hierarchy = ([klass] + klass.parents).reverse
hierarchy.each { |k|
- 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"