Showing 2,015 of 18,390 total issues
Method reconfigure_form_data
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def reconfigure_form_data(vm = @reconfigitems.first)
{
:recordId => @reconfigitems.collect(&:id),
:requestId => @request_id || 'new',
:roles => {
- Create a ticketCreate a ticket
Method perf_gen_tag_data_after_wait
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perf_gen_tag_data_after_wait
miq_task = MiqTask.find(params[:task_id]) # Not first time, read the task record
rpt = miq_task.miq_report_result.report_results # Grab the report object from the blob
miq_task.destroy # Get rid of the task and results
- Create a ticketCreate a ticket
Method show_taskbar_in_header?
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show_taskbar_in_header?
return false if @explorer
return false if controller.action_name.end_with?("tagging_edit")
hide_actions = %w[
- Create a ticketCreate a ticket
Method rate_summary
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rate_summary(data, optional)
rows = []
data.to_a.sort_by { |rd| [rd.chargeable_field[:group].downcase, rd.chargeable_field[:description].downcase, rd[:sub_metric].to_s.downcase] }.each_with_index do |detail, detail_index|
cells = []
tiers = detail.chargeback_tiers.order(:start)
- Create a ticketCreate a ticket
Method at_tree_select
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def at_tree_select(edit_key)
id = parse_nodetype_and_id(params[:id]).last
if params[:id].start_with?("aei-")
record = MiqAeInstance.find_by(:id => id)
@edit[:automate_tree_selected_path] = record.fqname
- Create a ticketCreate a ticket
Method build_tags_for_provisioning
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_tags_for_provisioning(wf, vm_tags, _edit_mode)
# for some reason @tags is set in wf, and it is changed by map bellow which causes bugs
wf.instance_variable_set(:@tags, nil)
tags = wf.allowed_tags.map do |cat|
{
- Create a ticketCreate a ticket
Method resolve_button_throw
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolve_button_throw
if valid_resolve_object?
add_flash(_("Automation Simulation has been run"))
@sb[:name] = @resolve[:new][:instance_name].presence || @resolve[:new][:other_name]
@sb[:attrs] = {}
- Create a ticketCreate a ticket
Method build_download_rpt
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_download_rpt(cols, csv, typ)
if typ.nil? || typ == "all"
if csv # If generating CSV, remove * from data
cols.each_with_index do |c, i|
if c.to_s.starts_with?("* ")
- Create a ticketCreate a ticket
Method adv_search_build
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def adv_search_build(model)
# Restore @edit hash if it's saved in @settings
@expkey = :expression # Reset to use default expression key
if session.fetch_path(:adv_search, model.to_s) && %w[tag service_tag].exclude?(@sb[:action])
adv_search_model = session[:adv_search][model.to_s]
- Create a ticketCreate a ticket
Method retrieve_git_datastore
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def retrieve_git_datastore
assert_privileges('miq_ae_class_import_export')
git_url = params[:git_url]
if git_url.blank?
- Create a ticketCreate a ticket
Method policy_field_changed
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def policy_field_changed
return unless load_edit("miq_policy_edit__#{params[:id]}")
case @edit[:typ]
when "events"
- Create a ticketCreate a ticket
Method ap_set_record_vars
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ap_set_record_vars(mems, scanitemset)
unless mems.empty?
mems_to_delete = []
mems.each { |m| mems_to_delete.push(m) }
ap_deletescanitems(mems_to_delete)
- Create a ticketCreate a ticket
Method delete_subnets
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delete_subnets
assert_privileges("cloud_subnet_delete")
subnets = find_records_with_rbac(CloudSubnet, checked_or_params)
subnets_to_delete = []
- Create a ticketCreate a ticket
Method button
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def button
case params[:pressed]
when "cloud_tenant_new"
javascript_redirect(:action => "new")
when "cloud_tenant_edit"
- Create a ticketCreate a ticket
Function miqJqueryRequest
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
window.miqJqueryRequest = function(url, options) {
if ((ManageIQ.observe.processing || ManageIQ.observe.queue.length) && (!options || !options.observe)) {
console.debug('Postponing miqJqueryRequest - waiting for the observe queue to empty first');
return new Promise((resolve, reject) => {
- 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 selectListElement
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var selectListElement = function(scope, timeout, ctrl, refresh) {
timeout(function() {
if (refresh) {
if (scope[scope['form_' + ctrl.$name + '_ngHide']] === true) {
angular.element(scope['form_' + ctrl.$name]).selectpicker('hide');
- 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 controller
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
controller: function() {
this.buttonClicked = function(event) {
if (this.enabled) {
this.onClick();
}
- 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 miqValidateButtons
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
window.miqValidateButtons = function(h_or_s, prefix) {
const buttonPrefix = prefix || '';
const buttonsOnId = `${buttonPrefix}validate_buttons_on`;
const buttonsOffId = `${buttonPrefix}validate_buttons_off`;
- 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 load_c3_charts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
window.load_c3_charts = function() {
for (var set in ManageIQ.charts.chartData) {
for (var i = 0; i < ManageIQ.charts.chartData[set].length; i++) {
var chart_id = 'miq_chart_' + set + '_' + i.toString();
var data = ManageIQ.charts.chartData[set][i];
- 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 miqOnLoad
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
window.miqOnLoad = function() {
// controller to be used in url in miqDropComplete method
ManageIQ.widget.dashboardUrl = 'dashboard/widget_dd_done';
// Initialize the dashboard column sortables
- 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"