Showing 739 of 829 total issues
Method configuration=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def configuration=(data)
unless data.is_a?(Hash)
data =
if data.is_a?(String)
JSON.parse(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 check_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_hash(ast)
ast.children.each do |child|
fail 'have not a valid options Hash format.' unless child.type == :pair
unless [:sym, :str].include?(child.children[0].type)
fail "contains a non valid key '#{child.children[0].location.expression.source}'"
- 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 regist_data_types
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def regist_data_types(data_types)
data_types = [data_types] unless data_types.is_a?(Enumerable)
data_types.each do |dt|
next unless dt.is_a?(Setup::DataType)
@nss[dt.namespace][dt.name] = dt
- 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 show_tour?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show_tour? (ip, user)
anonymous = user.nil?
show_tour = (anonymous ? where(ip: ip, :user_email.exists => false) : where(user_email: user.email)).blank?
if show_tour
attributes = anonymous ? { ip: ip } : { user_email: user.email, ip: ip }
- 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 transformation_types
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def transformation_types(*args)
if args.length.positive?
@transformation_types = args.flatten
else
@transformation_types || (superclass.is_a?(Setup::NotificationFlow) ? superclass.transformation_types : [])
- 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 inspect_updated_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def inspect_updated_fields
if @inspect_fields
inspecting_fields = self.inspecting_fields
changed_attributes.keys.each do |attr|
attr = attr.to_sym
- 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 target_model
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def target_model
data_type&.records_model ||
if (match = target_model_name.match(/\ADt(.+)\Z/))
if (data_type = Setup::DataType.where(id: match[1]).first)
data_type.records_model
- 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 schema=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def schema=(sch)
old_schema = schema
sch = JSON.parse(sch.to_s) unless sch.is_a?(Hash)
sch = sch.deep_stringify_keys
self.code = JSON.pretty_generate(sch)
- 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 attach
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def attach(attachment)
body = nil
store_options = { on: self.attachment }
if attachment.is_a?(Hash)
attachment.each do |key, value|
- 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 can?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def can?(action)
!(@allowed_actions || @denied_actions) ||
(@allowed_actions && @allowed_actions.include?(action)) ||
(@denied_actions && @denied_actions.exclude?(:all) && @denied_actions.exclude?(action)) ||
(superclass < Access && superclass.can?(action))
- 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 map_model
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def map_model
if source_data_type && target_data_type
if @mongoff_model && @mongoff_model.data_type != target_data_type
@mongoff_model = nil
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 validates_time_zone
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validates_time_zone(presence = false)
if time_zone.blank?
if presence
errors.add(:time_zone, "can't be blank")
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"
Further reading
Method read_raw_attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_raw_attribute(name)
if !(value = super).nil? &&
(new_record? || !self.class.build_in_data_type.protecting?(name) ||
(current_user = User.current) &&
(current_user.account_ids.include?(tenant_id) ||
- 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 cyclic_execution
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cyclic_execution(execution_graph, start_id, cycle = [])
if cycle.include?(start_id)
cycle << start_id
return cycle
elsif (adjacency_list = execution_graph[start_id])
- 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_for_destroy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validates_for_destroy
if ::User.super_access?
unless origin == :tmp || (build_in_dt = build_in).nil?
errors.add(:base, "#{custom_title} can not be destroyed because model #{build_in_dt.model} is present.")
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 for_each_ready
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def for_each_ready(opts = {}, &block)
return unless block
now = opts[:at] || Time.now
opts =
if (limit = opts[:limit])
- 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 translate_export
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def translate_export(message)
options = {
object_ids: object_ids_from(message),
source_data_type: data_type_from(message),
task: self,
- 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 origin_from
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def origin_from(message)
origin = message['origin'].to_s.to_sym
model = data_type_from(message).records_model
if model < CrossOrigin::CenitDocument
fail "Invalid origin :#{origin} for model #{model}" unless model.origins.include?(origin)
- 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"
Further reading
Method map_model
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def map_model
if source_data_type && target_data_type
if @mongoff_model && @mongoff_model.data_type != target_data_type
@mongoff_model = nil
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"