File cross_shared_collection.rb
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Setup
class CrossSharedCollection
include CenitUnscoped
include CrossOrigin::CenitDocument
include CollectionBehavior
Method install
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def install(options)
collection = options[:collection]
origin = options[:origin] || (self.origin == :default ? self.class.default_origin : self.origin)
collection.add_dependencies if options[:add_dependencies]
- 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
Class CrossSharedCollection
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class CrossSharedCollection
include CenitUnscoped
include CrossOrigin::CenitDocument
include CollectionBehavior
include Taggable
Method install
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def install(options)
collection = options[:collection]
origin = options[:origin] || (self.origin == :default ? self.class.default_origin : self.origin)
collection.add_dependencies if options[:add_dependencies]
Method config_pull_parameters
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def config_pull_parameters
unless @config_pull_parameters
@config_pull_parameters = []
[Setup::RemoteOauthClient, Setup::GenericAuthorizationClient].each do |client_model|
clients = COLLECTING_PROPERTIES.detect { |p| reflect_on_association(p).klass == client_model }.to_s
- 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 method_missing
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(symbol, *args)
if (match = /\Adata_(.+)\Z/.match(symbol.to_s)) &&
COLLECTING_PROPERTIES.include?(relation_name = match[1].to_sym) &&
((args.length.zero? && (options = {})) || args.length == 1 && (options = args[0]).is_a?(Hash))
if (items = send(relation_name)).present?
- 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 validates_pull_parameters
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def validates_pull_parameters
with_errors = false
data =
if installed
if new_record?
- 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 config_pull_parameters
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def config_pull_parameters
unless @config_pull_parameters
@config_pull_parameters = []
[Setup::RemoteOauthClient, Setup::GenericAuthorizationClient].each do |client_model|
clients = COLLECTING_PROPERTIES.detect { |p| reflect_on_association(p).klass == client_model }.to_s
Method validates_pull_parameters
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validates_pull_parameters
with_errors = false
data =
if installed
if new_record?
Consider simplifying this complex logical expression. Open
if (match = /\Adata_(.+)\Z/.match(symbol.to_s)) &&
COLLECTING_PROPERTIES.include?(relation_name = match[1].to_sym) &&
((args.length.zero? && (options = {})) || args.length == 1 && (options = args[0]).is_a?(Hash))
if (items = send(relation_name)).present?
items
Method generate_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def generate_data
hash = {}
if installed?
visited = Set.new
COLLECTING_PROPERTIES.each do |property|
- 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 hash_attribute_read
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def hash_attribute_read(name, value)
case name
when 'data'
installed? ? generate_data : value
when 'pull_data'
- 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 with_reset
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def with_reset(hash, model)
unless (_reset = hash['_reset'])
_reset = hash['_reset'] = []
end
hash.keys.each do |property|
- 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"