Showing 23 of 473 total issues
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"
Further reading
Method find_rows_in_single_batch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_rows_in_single_batch(options = {})
if options.key?(:batch_size)
fail ArgumentError,
"Can't pass :batch_size argument with a limit in the scope"
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 find_rows_in_batches
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_rows_in_batches(options = {}, &block)
return find_rows_in_single_batch(options, &block) if row_limit
options.assert_valid_keys(:batch_size)
batch_size = options.fetch(:batch_size, 1000)
batch_record_set = base_record_set = limit(batch_size)
- 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"