Showing 829 of 829 total issues
Avoid deeply nested control flow statements. Open
if scope.is_a?(Mongoid::Criteria)
scope.delete_all
else
scope.delete_many
end
Avoid deeply nested control flow statements. Open
value.delete(k) if v.empty?
Method check_snippet
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_snippet
if snippet_required?
configure_snippet
if snippet_ref.changed? && !snippet_ref.save
snippet_ref.errors.full_messages.each do |msg|
- 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 process_http_connection
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_http_connection(connection, template_parameters, verbose_response, last_response, options, &block)
Avoid deeply nested control flow statements. Open
next unless (base_properties = base_model['properties'])
Method parse_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_options(options)
options = options.to_s.strip
options = "{#{options}" unless options.start_with?('{')
options = "#{options}}" unless options.ends_with?('}')
ast =
- 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 configure_snippet
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def configure_snippet
if snippet_ref.new_record?
snippet_ref.namespace = snippet_ref.namespace.presence || namespace
name = snippet_ref.name.presence || snippet_name
i = 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
Avoid deeply nested control flow statements. Open
unless t_target_dt == sub_map_target_dt
sub_map.errors.add(:transformation, "target data type (#{t_target_dt ? t_target_dt.custom_title : 'nil'}) is invalid (#{sub_map_target_dt.custom_title} expected)")
end
Avoid deeply nested control flow statements. Open
options[:object_ids] = enum.collect { |obj| obj.id.is_a?(BSON::ObjectId) ? obj.id.to_s : obj.id }
Avoid deeply nested control flow statements. Open
if response_translator.data_type
rejects(:response_data_type)
else
requires(:response_data_type)
end
Avoid deeply nested control flow statements. Open
raise Exception.new("specification of property '#{property_name}' is not valid") unless property_spec.is_a?(Hash)
Method translate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def translate(message, &block)
if translator.present?
begin
flow_execution = current_thread_cache
flow_execution << (message[:execution_graph] || {}).merge('trigger_flow_id' => id.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
Avoid deeply nested control flow statements. Open
value.delete(k) if v.empty?
Avoid deeply nested control flow statements. Open
if (value = options[:value]).nil?
obj.delete(property_name) unless options[:keep_values]
else
obj[property_name] = value
end
Avoid deeply nested control flow statements. Open
enum = (limit ? model.limit(limit) : model.all).skip(offset).to_enum
Avoid deeply nested control flow statements. Open
options[:object_ids] = enum.collect { |obj| obj.id.is_a?(BSON::ObjectId) ? obj.id.to_s : obj.id }
Method start
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def start
return unless next_time
Setup::Task.where(scheduler: self).each do |task|
task.retry(action: :scheduled) unless TaskToken.where(task_id: task.id).exists?
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 method_missing
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(symbol, *args)
if CONFIG_FIELDS.any? { |field| "auth_#{field.pluralize}" == symbol.to_s }
ivar = "@#{symbol}".to_sym
instance_variable_set(ivar, args[0].stringify_keys) if args.length.positive?
value = instance_variable_get(ivar) || {}
- 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
Avoid deeply nested control flow statements. Open
if defined_types.include?(camelized_property_name) && !(property_spec['$ref'] || 'object'.eql?(property_spec['type']))
raise Exception.new("'#{name.underscore}' already defines #{property_name} (use #/[definitions|properties]/#{property_name} instead)")
end
Avoid deeply nested control flow statements. Open
unless scope_evaluator.parameters.first.name == 'scope'
errors.add(:scope_evaluator, "argument name should be 'scope'")
end