Showing 2,015 of 18,390 total issues
Function MiqStructuredListArray
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const MiqStructuredListArray = ({ row, onClick, clickEvents }) => {
/** Function to render a list item inside a cell */
/** Usage eg:
* 1. Control / Policies / Events
* 2. Automation / Automate / Explorer / Datastore / Method / Embedded Methods
- 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 get_custom_buttons
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_custom_buttons(model, record, toolbar_result)
cbses = CustomButtonSet.find_all_by_class_name(button_class_name(model), service_template_id(record))
cbses = CustomButtonSet.filter_with_visibility_expression(cbses, record)
cbses.sort_by { |cbs| cbs.set_data[:group_index] }.collect do |cbs|
- 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 class_field_data
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def class_field_data(field_data)
has_options = state_class?(field_data[:record].class_id)
datastore_options(has_options)
field_data[:fields].each_with_index do |field, index|
cells = []
- 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_catalog_resource
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def miq_catalog_resource(resources)
headers = ["", _("Name"), _("Description"), _("Action Order"), _("Provision Order"), _("Action Start"), _("Action Stop"), _("Delay (mins) Start"), _("Delay (mins) Stop")]
data = {:rows => [], :headers => headers}
prev_group = 0
resources.sort_by { |rsc| [rsc.group_idx, rsc.resource_name.downcase] }.each_with_index do |r, 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
Method rate_summary
has a Cognitive Complexity of 12 (exceeds 5 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)
- 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 deletestorages
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def deletestorages
assert_privileges("storage_delete")
storages = find_records_with_rbac(Storage, checked_or_params)
unless records_support_feature?(storages, 'delete')
add_flash(_("Only storage without VMs and Hosts can be removed"), :error)
- 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_alert_set_assigned
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def miq_summary_alert_set_assigned(assigned, alert_profile_tag)
rows = []
data = {:title => _('Assigned To'), :mode => "miq_alert_set_assigned"}
if !assigned[:objects].empty?
if assigned[:objects].first.kind_of?(MiqEnterprise)
- 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 remove_host
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def remove_host
assert_privileges("host_aggregate_remove_host")
@host_aggregate = find_record_with_rbac(HostAggregate, params[:id])
case params[:button]
- 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 add_host
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_host
assert_privileges("host_aggregate_add_host")
@host_aggregate = find_record_with_rbac(HostAggregate, params[:id])
case params[:button]
- 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 compare_section_data_cols
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def compare_section_data_cols(view, section, records)
row = {}
view.ids.each_with_index do |id, idx|
if idx.zero?
row.merge!(compare_add_txt_col(idx, @compressed ? "%:" : _("% Matched:")))
- 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 tagging_edit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def tagging_edit(db = nil, assert = true)
if nested_page?
assert_privileges("#{controller_for_common_methods}_tag")
elsif assert
assert_privileges("#{@display && @display != "main" && @display != "output" ? @display.singularize : controller_for_common_methods}_tag")
- 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_record_data_expanded_existsmode
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def comp_record_data_expanded_existsmode(idx, _match, value_found, last_value)
text = value_found ? _("Found") : _("Missing")
if idx.zero? # On the base?
if value_found # Base has the record
drift_add_image_col(idx, "fa fa-plus", "cell-stripe", text)
- 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 compare_to_json
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def compare_to_json(view)
@rows = []
@cols = []
@compressed = session[:miq_compressed]
session[:selected_sections] ||= []
- 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 exp_commit_regkey
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def exp_commit_regkey(exp)
if @edit[@expkey][:exp_regkey].blank?
add_flash(_("A registry key name must be entered to commit this expression element"), :error)
elsif @edit[@expkey][:exp_regval].blank? && @edit[@expkey][:exp_key] != "KEY EXISTS"
add_flash(_("A registry value name must be entered to commit this expression element"), :error)
- 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_automate_datastore
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def import_automate_datastore
assert_privileges('miq_ae_class_import_export')
if params[:selected_namespaces].present?
selected_namespaces = determine_all_included_namespaces(params[:selected_namespaces])
import_file_upload = ImportFileUpload.where(:id => params[:import_file_upload_id]).first
- 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 adv_search_build
has a Cognitive Complexity of 12 (exceeds 5 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]
- 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 handle_bottom_cell
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def handle_bottom_cell(nodetype, presenter, locals)
# Handle bottom cell
if @pages || @in_a_form && locals[:action_url] != "rbac_tags_edit"
if @pages
presenter.hide(:form_buttons_div)
- 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 form_field_changed
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def form_field_changed
assert_privileges('miq_ae_class_simulation')
get_form_vars
render :update do |page|
page << javascript_prologue
- 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 edit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def edit
assert_privileges("host_edit")
if session[:host_items].nil?
@host = find_record_with_rbac(Host, params[: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 set_right_cell_text
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def set_right_cell_text(id, rec = nil)
nodes = id.split('-')
case nodes[0]
when "root"
txt = _("Datastore")
- 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"