Showing 23 of 473 total issues
Method cast
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cast(value)
if value.is_a? Cassandra::Uuid then value
elsif defined?(SimpleUUID::UUID) && value.is_a?(SimpleUUID::UUID)
Cassandra::Uuid.new(value.to_i)
elsif value.is_a?(::Integer) || value.is_a?(::String)
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save(options = {})
super.tap do |success|
if success
if self.respond_to?(:changes_applied)
changes_applied
- 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 write_attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write_attribute(name, value)
column = self.class.reflect_on_column(name)
fail UnknownAttributeError, "unknown attribute: #{name}" unless column
value = column.cast(value) unless value.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"