File attribute.rb
has 832 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ObjectManager::Attribute < ApplicationModel
include HasDefaultModelUserRelations
include ChecksClientNotification
include CanSeed
Method migration_execute
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def self.migration_execute(send_event = true)
# check if field already exists
execute_db_count = 0
execute_config_count = 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 migration_execute
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.migration_execute(send_event = true)
# check if field already exists
execute_db_count = 0
execute_config_count = 0
Method add
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def self.add(data)
force = data[:force]
data.delete(:force)
# lookups
- 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 Attribute
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class ObjectManager::Attribute < ApplicationModel
include HasDefaultModelUserRelations
include ChecksClientNotification
include CanSeed
Method add
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.add(data)
force = data[:force]
data.delete(:force)
# lookups
Method check_name
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def check_name
return if !name
if name.match?(%r{.+?_(id|ids)$}i)
errors.add(:name, __("can't be used because *_id and *_ids are not allowed"))
- 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 check_name
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_name
return if !name
if name.match?(%r{.+?_(id|ids)$}i)
errors.add(:name, __("can't be used because *_id and *_ids are not allowed"))
Method remove
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.remove(data)
# lookups
if data[:object]
data[:object_lookup_id] = ObjectLookup.by_name(data[:object])
Method remove
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.remove(data)
# lookups
if data[:object]
data[:object_lookup_id] = ObjectLookup.by_name(data[:object])
- 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 attribute_used_by_references
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.attribute_used_by_references(object_name, attribute_name, references = attribute_to_references_hash)
result = {}
references.each do |reference_key, relations|
local_object, local_attribute = reference_key.split('.')
next if local_object != object_name.downcase
- 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 set_base_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_base_options
local_data_option[:null] = true if local_data_option[:null].nil?
case data_type
when %r{^((multi|tree_)?select|checkbox)$}
- 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 attribute_to_references_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.attribute_to_references_hash
attribute_list = {}
attribute_to_references_hash_objects
.map { |elem| elem.select(:name, :condition) }
- 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 attribute_used_by_references?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.attribute_used_by_references?(object_name, attribute_name, references = attribute_to_references_hash)
references.each_key do |reference_key|
local_object, local_attribute = reference_key.split('.')
next if local_object != object_name.downcase
next if local_attribute != attribute_name
- 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"