Showing 4 of 4 total issues
Method after_initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def after_initialize
raise "key should be a string or symbol!" unless key.is_a? String or key.is_a? Symbol
raise "value should not be empty!" if @value.is_a? String and value.empty?
raise "value should not be nil!" if @value.nil?
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 fill_options_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.fill_options_hash(options)
sanity_check options
# Generate a unique class name based on the eav_hash's name and owner
options[:entry_class_name] ||= "#{options[:parent_class_name]}_#{options[:hash_name]}_entry".camelize.to_sym
- 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 save_entries
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save_entries
# The entries are lazy-loaded, so don't do anything if they haven't been accessed or modified
return unless (@entries and @changes_made)
@entries.values.each do |entry|
- 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 run_find_expression
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.run_find_expression (key, value, options)
sanity_check options
raise "Can't search for a nil key!" if key.nil?
if value.nil?
options[:entry_class].where(
- 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"