Showing 6 of 6 total issues
Method merge!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def merge! data
root_model = @root_node[:class_name].constantize
root_model.reflections.each do |ref_name, reflection|
next unless data[ref_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 allow_column?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def allow_column? model, col
if @keep_columns[model.name].to_a.include? col
return true
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 follow_reflection?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def follow_reflection? ref, parent_rec
return false if !ref.macro.in? [:belongs_to, :has_many, :has_one]
return false if ref.options[:through] # Skip :through assossiations
return false if !ref.active_record.name == ref.class_name # Skip self joins
return false if !ref.class_name.in? @allow_models.to_a
- 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
Avoid too many return
statements within this method. Open
return false if @deny_models.include? ref.class_name
Avoid too many return
statements within this method. Open
return false if parent_rec and parent_rec.class == ref.klass # Deny model go back up to the parent class
Method traverse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def traverse rec, parent_rec, parent_node = nil, excl_foreign_key = nil
data_columns = get_data_columns(rec.class) - [excl_foreign_key]
node = @node_set.find_or_create rec, data_columns
- 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"