Showing 5 of 5 total issues
Class Instance
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Instance
def initialize(model)
@model = model
@config = model.class.can_be_config
@field_name = @config.field_name
Method details_matches?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def details_matches?
return true unless @expected_details
@config.details.each do |can_be_type, model|
return false unless @expected_details[can_be_type] == model
- 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 update_field
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_field(t, options = {})
@original_details = @model.send(@details_name)
@force_history_removal = options[:force_history_removal] if options.has_key?(:force_history_removal)
save = options.has_key?(:save) ? options[:save] : false
- 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 clean_details
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def clean_details
if @original_details && @original_details.class != @model.send(@details_name).class
if @config.keeps_history?
if @force_history_removal
@original_details.destroy
- 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 set_details
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_details(t)
return unless has_details?
if details_class_name(t)
if @config.keeps_history?
- 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"