Showing 42 of 95 total issues
Function open_ajax_box
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var open_ajax_box = function( params )
{
var magnific_popup_params =
{
showCloseBtn : false,
Function get_notification_ids
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var get_notification_ids = function( params )
{
var notification_ids = [];
if (typeof params === 'string')
Method add_resource_breadcrumb
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_resource_breadcrumb(resource, url = nil)
if resource.new_record?
name= I18n.t('New record', scope: 'admin.breadcrumbs')
url = url_for(action: :new, only_path: true) if url.nil?
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 releaf_item_field
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def releaf_item_field(name, input: {}, label: {}, field: {}, options: {}, &block)
label_options = {translation_key: name.to_s.sub(/_id$/, '').to_s}
attributes = input_attributes(name, {value: object.send(name)}.merge(input), options)
options = {field: {type: "item"}, label: label_options}.deep_merge(options)
- 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( this.query[ name ] === undefined || !(this.query[ name ] instanceof Array) )
{
this.query[ name ] = [];
}
Avoid deeply nested control flow statements. Open
for( var b in temp.query )
{
if (temp.query.hasOwnProperty(b))
{
this.query[ b ] = temp.query[b];
Avoid deeply nested control flow statements. Open
if( this.query[ name ] === undefined || !(this.query[ name ] instanceof Array) )
{
this.query[ name ] = [];
}
Method duplicate_dragonfly_attachments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def duplicate_dragonfly_attachments(original, copy)
attachment_keys = original.dragonfly_attachments.keys
return unless attachment_keys.present?
# during the dup() call the copy object has its dragonfly_attachments property duplicated from the original.
- 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 destroy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def destroy
begin
content
rescue NameError => e
raise if content_id.nil? && content_type.nil?
- 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 auto_create?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def auto_create?(key, options)
return false unless config.i18n_database.translation_auto_creation
return false if options[:auto_create] == false
return false unless auto_creation_inclusion?(key)
return false if auto_creation_exception?(key)
- 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 join_reflection_without_through
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def join_reflection_without_through(reflection, table)
klass = reflection.active_record
other_class = reflection.klass
table1 = table || klass.arel_table
- 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 build_tree
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_tree
object_hash = collection.inject({}) do |result, node|
result[node.id] = { node: node, children: [] }
result
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 releaf_button_content
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def releaf_button_content( text, icon, attributes = {} )
if text.blank? && icon.present?
raise ArgumentError, "Title is required for icon-only buttons" if attributes[:title].blank?
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 tree_resource_collapser
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def tree_resource_collapser(resource, expanded)
return if resource[:children].empty?
tag(:div, class: "collapser-cell") do
button(nil, (expanded ? 'chevron-down' : 'chevron-right'), class: %w(secondary collapser trigger), title: t(expanded ? "Collapse" : "Expand"))
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
Avoid too many return
statements within this method. Open
return false if stored_keys.key?(key)
Avoid too many return
statements within this function. Open
return;
Method releaf_button_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def releaf_button_attributes( text, icon, attributes = {} )
default_attributes = {
class: ["button"],
title: text
}
- 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 normalize_controllers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.normalize_controllers(list)
list.map do |item|
if item.is_a?(Hash) && item.has_key?(:items)
ControllerGroupDefinition.new(item)
elsif item.is_a?(Hash) || item.is_a?(String)
- 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 join_search_tables
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def join_search_tables klass, attributes: fields, table: klass.arel_table
attributes.each do |attribute|
if attribute.is_a? Hash
attribute.each_pair do |key, values|
reflection = klass.reflect_on_association(key.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 item_position_select_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def item_position_select_options
after_text = t("After")
list = [[t("First"), 0]]
order_nodes = object.self_and_siblings.reorder(:item_position).to_a
- 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"