Showing 2,015 of 18,390 total issues
Method menu_field_changed
has a Cognitive Complexity of 123 (exceeds 5 allowed). Consider refactoring. Open
def menu_field_changed
assert_privileges("miq_report_menu_editor")
return unless load_edit("menu_edit__#{session[:role_choice] ? session[:role_choice] : "new"}", "replace_cell__explorer")
menu_get_form_vars
- 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
Class ApplicationController
has 123 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
include Vmdb::Logging
if Vmdb::Application.config.action_controller.allow_forgery_protection
# Add CSRF protection for this controller, which enables the
- Create a ticketCreate a ticket
Method prov_get_form_vars
has a Cognitive Complexity of 118 (exceeds 5 allowed). Consider refactoring. Open
def prov_get_form_vars
if params[:ids_checked] # User checked/unchecked a tree node
ids = params[:ids_checked]
# for some reason if tree is not expanded clicking on radiobuttons this.getAllChecked() sends up extra blanks
@edit.store_path(:new, tag_symbol_for_workflow, ids.select(&:present?).collect(&:to_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
File buttons.rb
has 985 lines of code (exceeds 400 allowed). Consider refactoring. Open
module ApplicationController::Buttons
extend ActiveSupport::Concern
included do
include Mixins::PlaybookOptions
- Create a ticketCreate a ticket
File miq_request_methods.rb
has 954 lines of code (exceeds 400 allowed). Consider refactoring. Open
module ApplicationController::MiqRequestMethods
extend ActiveSupport::Concern
include RequestInfoHelper
included do
helper_method :dialog_partial_for_workflow
- Create a ticketCreate a ticket
Method replace_right_cell
has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring. Open
def replace_right_cell(options = {})
action, replace_trees, presenter = options.values_at(:action, :replace_trees, :presenter)
@explorer = true
# FIXME: make this functional
- 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 prepare_data_for_compare_or_drift_report
has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring. Open
def prepare_data_for_compare_or_drift_report(mode, csv)
sb_key = mode == :compare ? :miq_temp_params : :miq_drift_params
# Collect the data from the @compare object
@data = []
- 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 replace_right_cell
has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring. Open
def replace_right_cell(options = {})
if params[:action] == 'x_history'
# Making selected checkboxes array empty when compare cancel is clicked
params[:miq_grid_checks] = []
end
- 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 build_selected_fields
has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring. Open
def build_selected_fields(rpt)
fields = []
headers = {}
col_formats = {}
pivot_cols = {}
- 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_chooser
has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring. Open
def chart_chooser
assert_privileges('utilization')
unless params[:task_id] # Only do this first time thru
@sb[:options][:chart_date] = params[:miq_date_1] if params[:miq_date_1]
@sb[:options][:chart_date] = params[:miq_date_2] if params[:miq_date_2]
- 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
File common.rb
has 870 lines of code (exceeds 400 allowed). Consider refactoring. Open
module OpsController::Settings::Common
extend ActiveSupport::Concern
include OpsHelper
logo_dir = File.expand_path(File.join(Rails.root, "public/upload"))
- Create a ticketCreate a ticket
Method set_record_vars
has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring. Open
def set_record_vars(rpt)
# Set the simple string/number fields
rpt.template_type = "report"
rpt.name = @edit[:new][:name].to_s.strip
rpt.title = @edit[:new][:title].to_s.strip
- 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_edit
has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring. Open
def condition_edit
case params[:button]
when "cancel"
id = params[:id] || "new"
return unless load_edit("condition_edit__#{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 atomic_req_submit
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
def atomic_req_submit
id = session[:edit][:req_id] || "new"
return unless load_edit("prov_edit__#{id}", "show_list")
if @edit[:new][:name].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
File report_controller.rb
has 814 lines of code (exceeds 400 allowed). Consider refactoring. Open
require 'yaml'
class ReportController < ApplicationController
DEFAULT_SORT_COLUMN_NUMBER = 2
DEFAULT_SORT_ORDER = "DESC".freeze
- Create a ticketCreate a ticket
Function MiqTableCell
has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring. Open
const MiqTableCell = ({
cell, onCellClick, row, truncate,
}) => {
const [confirm, setConfirm] = useState(false);
- 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 button
has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring. Open
def button
@edit = session[:edit] # Restore @edit for adv search box
params[:display] = @display if ["vms", "hosts", 'host_aggregates', "storages", "instances", "images", "orchestration_stacks"].include?(@display) # Were we displaying vms/hosts/storages
params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh
- 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 settings_form_field_changed
has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring. Open
def settings_form_field_changed
assert_privileges("ops_settings")
settings_get_form_vars
return unless @edit
- 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 ab_get_node_info
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
def ab_get_node_info(node)
@nodetype = node.split("_")
nodeid = node.split("-")
# initializing variables to hold data for selected node
- 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
File ci_processing.rb
has 775 lines of code (exceeds 400 allowed). Consider refactoring. Open
module ApplicationController::CiProcessing
extend ActiveSupport::Concern
included do
include Mixins::Actions::VmActions::Ownership
- Create a ticketCreate a ticket