lib/ooor/relation.rb
Class Relation
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Relation
attr_reader :klass, :loaded
attr_accessor :options, :count_field, :includes_values, :eager_load_values, :preload_values,
:select_values, :group_values, :order_values, :reorder_flag, :joins_values, :where_values, :having_values,
:limit_value, :offset_value, :lock_value, :readonly_value, :create_with_value, :from_value, :page_value, :per_value
Method to_a
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def to_a
if loaded?
@records
else
if @order_values.empty?
- 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 load_records_page
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def load_records_page(search_order)
if @per_value && @page_value
offset = @per_value * @page_value
limit = @per_value
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"