Class Tableless
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
class AssociationScope < ActiveRecord::Associations::AssociationScope
INSTANCE = create
def self.scope(association, connection)
INSTANCE.scope association, connection
Method target_scope
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def target_scope
super.tap do |scope|
if klass < ActiveScaffold::Tableless
class << scope; include RelationExtension; end
assoc_conditions = scope.proxy_association&.send(:association_scope)&.conditions
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(name, default, sql_type = nil, null = true, **)
Method where
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def where(opts, *rest)
if opts.present?
opts = opts.with_indifferent_access if opts.is_a? Hash
@conditions << (rest.empty? ? opts : [opts, *rest])
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 except
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def except(*skips)
super.tap do |new_relation|
unless new_relation.is_a?(RelationExtension)
class << new_relation; include RelationExtension; end
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"