Showing 2,015 of 18,390 total issues
Method selected_menu_consecutive?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def selected_menu_consecutive?
first_idx = last_idx = 0
@edit[:selected_reports].each_with_index do |nf, idx|
first_idx = idx if nf == params[:selected_reports].first
if nf == params[:selected_reports].last
- Read upRead up
- Create a ticketCreate a ticket
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 condition_field_changed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def condition_field_changed
return unless load_edit("condition_edit__#{params[:id]}")
@condition = @edit[:condition_id] ? Condition.find(@edit[:condition_id]) : Condition.new
- Read upRead up
- Create a ticketCreate a ticket
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 db_selected_consecutive?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def db_selected_consecutive?
first_idx = last_idx = 0
@edit[:new][:dashboard_order].each_with_index do |nf, idx|
first_idx = idx if nf == params[:seq_fields].first
if nf == params[:seq_fields].last
- Read upRead up
- Create a ticketCreate a ticket
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 x_get_tree_miq_server_kids
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def x_get_tree_miq_server_kids(parent, _count_only)
parent.assigned_server_roles.sort_by { |asr| asr.server_role.description }.each_with_object([]) do |asr, objects|
next if parent.kind_of?(MiqRegion) && !asr.server_role.regional_role? # Only regional roles under Region
next if asr.server_role.name == "database_owner"
objects.push(asr)
- Read upRead up
- Create a ticketCreate a ticket
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 x_get_tree_hash_kids
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def x_get_tree_hash_kids(parent, count_only)
nodes = parent[:nodes].map do |policy|
icon = policy.towhat.safe_constantize.try(:decorate).try(:fonticon)
mode = if policy.mode == "control"
_("Control")
- Read upRead up
- Create a ticketCreate a ticket
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 count_only_or_objects
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def count_only_or_objects(count_only, objects, sort_by = nil)
if count_only
objects.respond_to?(:order) ? objects.except(:order).size : objects.size
elsif sort_by.kind_of?(Proc)
objects.sort_by(&sort_by)
- Read upRead up
- Create a ticketCreate a ticket
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 section_for_item_id
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def section_for_item_id(item_id)
found = nil
@id_to_section.each do |_id, section|
next unless section.contains_item_id?(item_id)
- Read upRead up
- Create a ticketCreate a ticket
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 import_widgets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def import_widgets(import_file_upload, widgets_to_import)
number_imported_widgets = 0
unless widgets_to_import.nil?
widgets = YAML.load(import_file_upload.uploaded_content)
- Read upRead up
- Create a ticketCreate a ticket
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 active_node_set
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def active_node_set(tree_nodes)
stack = [tree_nodes.last]
while stack.any?
node = stack.pop
# If the node's text has an active suffix, return with it
- Read upRead up
- Create a ticketCreate a ticket
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 x_get_tree_datacenter_kids
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def x_get_tree_datacenter_kids(parent, count_only)
children = parent.folders.each_with_object([]) do |child, arr|
next if !child.kind_of?(EmsFolder) || child.name == 'host'
child.name == 'vm' ? arr.concat(child.folders_only) : arr.push(child)
- Read upRead up
- Create a ticketCreate a ticket
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 function. Open
return cellValue;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return `${value}.bytes`;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
if (hasToggle(keys)) return { ...content, component: cellToggle(data, id), cellClick: false };
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
if (hasTextInput(keys)) return { ...content, component: cellTextInput(data, id), cellClick: false };
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return `${value} B`;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return { ...content, component: cellText() };
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return Number(sizeValue);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return value
.replace('.gigabytes', ' GB')
.replace('.megabytes', ' MB')
.replace('.kilobytes', ' KB')
.replace('.bytes', ' B');
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (
<TableCard title={title} chartData={chartData} />
);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (
<AreaChartCard title={title} textNumber={textNumber} textUnit={textUnit} textTitle={textTitle} chartData={chartData} options={options} />
);
- Create a ticketCreate a ticket