Showing 2,015 of 18,390 total issues
Function sanitize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const sanitize = function(data) {
if (isPlainObject(data) && (data.error || data.message)) {
return (data.error || '').toString() + ' ' + (data.message || '').toString();
}
- 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
Function WorkflowEntryPoints
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const WorkflowEntryPoints = ({ field, selected, type }) => {
const [data, setData] = useState({
isLoading: true, list: {}, selectedItemId: selected,
});
- 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 miq_summary_policy_set_notes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def miq_summary_policy_set_notes(record)
data = {:title => _("Notes"), :mode => "miq_policy_set_notes"}
rows = []
if record.set_data.present? && (record.set_data[:notes] || record.set_data["notes"])
if record.set_data[:notes].blank? && record.set_data["notes"].blank?
- 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 visibility
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def visibility(custom_button, sb_items)
show_to = custom_button.visibility.nil? || (custom_button.visibility && custom_button.visibility[:roles] && custom_button.visibility[:roles][0] == "_ALL_") ? _("To All") : _("By Role")
data = {
:title => _('Visibility'),
:mode => _('visibility'),
- 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 check_smart_roles
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_smart_roles
my_zone = MiqServer.my_server.my_zone
MiqServer::ServerSmartProxy::SMART_ROLES.each do |role|
next if MiqServer.all.any? do |s|
s.has_active_role?(role) &&
- 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 expand_textual_summary
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def expand_textual_summary(summary, context)
case summary
when Hash
summary
when Symbol
- 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 human_size_to_rails_method
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def human_size_to_rails_method(size)
s = size.dup
if size.ends_with?(" Byte")
s[-5..-1] = ""
elsif size.ends_with?(" Bytes")
- 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 mhz_to_human_size
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def mhz_to_human_size(size, *args)
precision = args.first
precision = precision[:precision] if precision.kind_of?(Hash)
precision ||= 1
- 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 company_category_rows
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def company_category_rows(categories)
categories.map do |category|
{
:id => category[:id].to_s,
:clickable => true,
- 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 display_selected
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def display_selected(chart_click_data, ts, data_row, bc_model)
dt = @perf_options[:typ] == "Hourly" ? "on #{ts.to_date} at #{ts.strftime("%H:%M:%S %Z")}" : "on #{ts.to_date}"
state = chart_click_data.type == "on" ? _("running") : _("stopped")
if data_row["assoc_ids"][chart_click_data.model.downcase.to_sym][chart_click_data.type.to_sym].blank?
message = _("No %{model} were %{state} %{time}") % {:model => chart_click_data.model, :state => state, :time => dt}
- 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 object_types_for_flash_message
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def object_types_for_flash_message(klass, record_ids)
if klass == VmOrTemplate
object_ary = klass.where(:id => record_ids).collect { |rec| ui_lookup(:model => model_for_vm(rec).to_s) }
obj_hash = object_ary.each.with_object(Hash.new(0)) { |obj, h| h[obj] += 1 }
obj_hash.collect { |k, v| v == 1 ? k : k.pluralize }.sort.to_sentence
- 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 chart_current_daily
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def chart_current_daily
@record = identify_tl_or_perf_record
@perf_record = @record.kind_of?(MiqServer) ? @record.vm : @record # Use related server vm record
@perf_options[:typ] = "Daily"
perf_set_or_fix_dates(false) unless params[:task_id] # Set dates if first time thru
- 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 chart_selected
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def chart_selected(chart_click_data, data_row, ts)
@record = find_record_with_rbac(data_row["resource_type"].constantize, data_row["resource_id"])
return [true, nil] unless @record
# Set the perf options in the selected controller's sandbox
- 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 record_no_longer_exists?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def record_no_longer_exists?(what, model = nil)
return false unless what.nil?
if !@bang || @flash_array.empty?
# We already added a better flash message in 'identify_record'
- 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_to_controller
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def db_to_controller(db, action = "show")
action = "x_show" if @explorer
case db
when "ActionSet"
controller = "miq_action"
- 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 chart_current_hourly
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def chart_current_hourly(ts)
@record = identify_tl_or_perf_record
@perf_record = @record.kind_of?(MiqServer) ? @record.vm : @record # Use related server vm record
@perf_options[:typ] = "Hourly"
@perf_options[:hourly_date] = [ts.month, ts.day, ts.year].join("/")
- 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 resolve_button_simulate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def resolve_button_simulate
@edit = copy_hash(session[:resolve])
@resolve[:new][:attrs] = []
if @edit[:new][:attrs]
attrs = copy_array(@edit[:new][:attrs]) # using copy_array, otherwise on simulation screen it was updating @edit attrs as well while updating attrs for resolve
- 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 drift_analysis
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def drift_analysis
assert_privileges("common_drift")
controller_name = @sb[:compare_db].underscore
identify_obj
tss = find_checked_items # Get the indexes of the checked timestamps, not db IDs
- 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 comp_add_record_field_missing_compressed
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def comp_add_record_field_missing_compressed(idx, val, base_rec)
if @exists_mode
passed_img = "fa fa-check"
failed_img = "fa fa-times"
else
- 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 comp_add_record_field_missing_expanded
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def comp_add_record_field_missing_expanded(idx, base_rec, field)
if @exists_mode
passed_text_color = failed_text_color = "black"
else
passed_text_color = "#403990"
- 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"