Class Many
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Many < Relations::Many
delegate :count, to: :criteria
delegate :first, :in_memory, :last, :reset, :uniq, to: :target
File many.rb
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mongoid
module Relations
module Referenced
# This class defines the behaviour for all relations that are a
Method remove_not_in
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def remove_not_in(ids)
removed = criteria.not_in(_id: ids)
if __metadata.destructive?
removed.delete_all
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 purge
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def purge
unless __metadata.destructive?
nullify
else
after_remove_error = 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 concat
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def concat(documents)
docs, inserts = [], []
documents.each do |doc|
next unless doc
append(doc)
- 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"