Showing 10 of 10 total issues
Class Scope
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Scope
DISALLOWED_ARRAY_METHODS = [
:compact!, :flatten!, :reject!, :reverse!, :rotate!, :map!,
:shuffle!, :slice!, :sort!, :sort_by!, :delete_if,
:keep_if, :pop, :shift, :delete_at, :compact
Class Base
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
extend ActiveSupport::DescendantsTracker
extend ActiveModel::Naming
include ActiveModel::Conversion
include ActiveModel::AttributeMethods
File scope.rb
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
module FrozenRecord
class Scope
DISALLOWED_ARRAY_METHODS = [
:compact!, :flatten!, :reject!, :reverse!, :rotate!, :map!,
:shuffle!, :slice!, :sort!, :sort_by!, :delete_if,
File base.rb
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'active_support/descendants_tracker'
require 'frozen_record/backends'
module FrozenRecord
SlowQuery = Class.new(StandardError)
Method select_records
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select_records(records)
return records if @where_values.empty? && @where_not_values.empty?
indices = @klass.index_definitions
indexed_where_values, unindexed_where_values = @where_values.partition { |criteria| indices.key?(criteria.first) }
Method select_records
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def select_records(records)
return records if @where_values.empty? && @where_not_values.empty?
indices = @klass.index_definitions
indexed_where_values, unindexed_where_values = @where_values.partition { |criteria| indices.key?(criteria.first) }
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load(file_path)
if !File.exist?(file_path) && File.exist?("#{file_path}.erb")
file_path = "#{file_path}.erb"
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 memsize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def memsize(object = self, seen = Set.new.compare_by_identity)
return 0 unless seen.add?(object)
size = ObjectSpace.memsize_of(object)
object.instance_variables.each { |v| size += memsize(object.instance_variable_get(v), seen) }
- 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 compare
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def compare(record_a, record_b)
@order_values.each do |attr, order|
a_value, b_value = record_a.send(attr), record_b.send(attr)
cmp = a_value <=> b_value
next if cmp == 0
- 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 unload_fixture
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unload_fixture(model_class)
return unless defined?(@cache) && @cache
ensure_model_class_is_frozenrecord(model_class)
- 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"