Showing 2,015 of 18,390 total issues
Avoid deeply nested control flow statements. Open
@visibility_expression_table = exp_build_table(@custom_button.visibility_expression.exp) if @custom_button.visibility_expression.kind_of?(MiqExpression)
- Create a ticketCreate a ticket
Method show_association
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def show_association(action, display_name, method, klass, association = nil, scopes = nil)
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
button_order = @record[:set_data] && @record[:set_data][:button_order] ? @record[:set_data][:button_order] : nil
- Create a ticketCreate a ticket
Method build_field_order
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_field_order
@edit[:new][:field_order] = []
@edit[:new][:fields].each do |f|
if @edit[:new][:pivot] && @edit[:new][:pivot].by1 != ReportHelper::NOTHING_STRING && # If we are doing pivoting and
@edit[:pivot_cols].key?(f.last) # this is a pivot calc column
- 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 deeply nested control flow statements. Open
@edit[:new][:sortby2] = field_key + (suffix2 ? "__#{suffix2}" : "") if col == sort2
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
g[:scaling_max] = g[:scaling_min] if g[:scaling_max] < g[:scaling_min]
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
template_locals.merge!(fetch_ovf_template_details) if need_ovf_template_locals?
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
template_locals.merge!(fetch_terraform_template_details) if need_terraform_locals?
- Create a ticketCreate a ticket
Method open_parent_nodes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def open_parent_nodes
existing_node = nil
nodes = params[:id].split('_')
nodes.pop
parents = []
- 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 deeply nested control flow statements. Open
@edit[:new][:perf_target_pct3] = params[:percent3] == "<None>" ? nil : params[:percent3].to_i
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
presenter.replace(:flash_msg_div, r[:partial => "layouts/flash_msg"]) if @flash_array
- Create a ticketCreate a ticket
Method task_supported
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def task_supported(typ)
vms = find_records_with_rbac(VmOrTemplate, checked_or_params)
if %w[migrate publish].include?(typ) && vms.any?(&:template?)
render_flash_not_applicable_to_model(typ, ui_lookup(:table => "miq_template"))
return
- 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 deeply nested control flow statements. Open
if params[:break_format].blank? || # Remove format and col key (if empty)
params[:break_format].to_sym == MiqReport.get_col_info(@edit[:new][:sortby1])[:default_format]
if @edit[:new][:col_options][co_key1]
@edit[:new][:col_options][co_key1].delete(:break_format)
@edit[:new][:col_options].delete(co_key1) if @edit[:new][:col_options][co_key1].empty?
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if param_value
p_index = @edit[:new][:rsc_groups].flatten.collect { |rg| rg[:provision_index].to_i }.sort
# if index that came in is being used more than once
if p_index.count(g[key]) > 1
- Create a ticketCreate a ticket
Method build_audit_payload
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_audit_payload(rec, eh_new, eh_current, event, message, description = nil)
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
g[key] = param_value.to_i if param_value
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
elsif nodetype == "menu_commit_reports"
presenter.replace(:flash_msg_div, r[:partial => "layouts/flash_msg"]) if @flash_array
presenter.scroll_top if @flash_array.present?
if @refresh_div
presenter.hide(:flash_msg_div)
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
@right_cell_text = if @rpt.id
_("Editing Report \"%{name}\"") % {:name => @rpt.name}
else
_("Adding a new Report")
end
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
presenter.scroll_top if @flash_array.present?
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
g[key] = param_value if param_value
- Create a ticketCreate a ticket