Showing 2,015 of 18,390 total issues
Method log_privileges
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def log_privileges(pass, details = nil)
# This is called with or without a current user and possibly a fake request such as in test.
username = current_userid rescue nil
role_name = current_user.miq_user_role.name rescue nil
http_method = request.respond_to?(:request_method) ? request.request_method : nil
- 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 saved_report_delete
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def saved_report_delete
assert_privileges("saved_report_delete")
savedreports = find_checked_items
if savedreports.blank?
report_result = x_node.split('_').last
- 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 create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create
assert_privileges("floating_ip_new")
case params[:button]
when "add"
options = form_params
- 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 show_list
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def show_list
@breadcrumbs = []
bc_name = _("Requests")
@request_tab = params[:typ] if params[:typ] # set this to be used to identify which Requests subtab was clicked
@layout = layout_from_tab_name(@request_tab)
- 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 x_get_tree_st_kids
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def x_get_tree_st_kids(object, count_only)
@resolve ||= {}
items = object.custom_button_sets + object.custom_buttons
objects = []
- 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 createSchema
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createSchema(ids, endpointFields, emptySchema, getHostData) {
const fields = [
...(ids.length <= 1
? [{
component: componentTypes.TEXT_FIELD,
- Create a ticketCreate a ticket
Function setUpImportClickHandlers
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.setUpImportClickHandlers = function(url, grid, importCallback) {
$('.import-commit').click(function() {
miqSparkleOn();
clearMessages();
- Create a ticketCreate a ticket
Function formCatalogData
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const formCatalogData = () => {
const catalogData = {
name: '',
description: '',
service_template_id: '',
- Create a ticketCreate a ticket
Function setDiskData
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const setDiskData = (disks, roles, data, setData) => {
const diskData = [];
disks.forEach((disk, i) => {
const id = `disk${i}`;
diskData[i] = {
- Create a ticketCreate a ticket
Function settingsCompanyCategoriesData
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const settingsCompanyCategoriesData = () => {
const headers = [
{ header: _('Name'), key: 'name' },
{ header: _('Description'), key: 'description' },
{ header: _('Show in Console'), key: 'show' },
- Create a ticketCreate a ticket
Function generateRefreshOptions
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const generateRefreshOptions = (constrained = false, initialStep = 50, initialIndex = 200) => {
let index = initialIndex;
let step = initialStep;
const options = [];
while (index < 1000) {
- Create a ticketCreate a ticket
Function addMenu
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const addMenu = (items, locked) => {
const title = locked
? __('Cannot add a Widget, this Dashboard has been locked by the Administrator')
: __('Add widget');
const buttonName = __('Add widget');
- Create a ticketCreate a ticket
Method timeline_current
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def timeline_current(chart_click_data, ts)
@record = identify_tl_or_perf_record
@perf_record = @record.kind_of?(MiqServer) ? @record.vm : @record # Use related server vm record
new_opts = tl_session_data(request.parameters["controller"]) || ApplicationController::Timelines::Options.new
new_opts[:model] = @perf_record.class.base_class.to_s
- Create a ticketCreate a ticket
Method process_storage
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_storage(storages, task, _ = nil)
storages, _storages_out_region = filter_ids_in_region(storages, _("Datastore"))
return if storages.empty?
if task == "destroy"
- Create a ticketCreate a ticket
Method process_objects
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_objects(objs, task, display_name = nil)
klass = record_class
klass_str = klass.to_s
assert_rbac(klass, objs)
- Create a ticketCreate a ticket
Method set_dates
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_dates(start_date, end_date, allow_interval_override)
tz = time_profile_tz || self.tz # Use time profile tz or chosen tz, if no profile tz
self.sdate = start_date.in_time_zone(tz)
self.edate = end_date.in_time_zone(tz)
self.sdate_daily = sdate.hour.zero? ? sdate : sdate + 1.day
- Create a ticketCreate a ticket
Method edit
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def edit
assert_privileges("host_edit")
if session[:host_items].nil?
@host = find_record_with_rbac(Host, params[:id])
- Create a ticketCreate a ticket
Method validate_method_data
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_method_data
assert_privileges("miq_ae_method_edit")
return unless load_edit("aemethod_edit__#{params[:id]}", "replace_cell__explorer")
@edit[:new][:data] = params[:cls_method_data] if params[:cls_method_data]
- Create a ticketCreate a ticket
Method cu_collection_update
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cu_collection_update
assert_privileges("region_edit")
return unless load_edit("cu_edit__collection", "replace_cell__explorer")
- Create a ticketCreate a ticket
Method set_rate_details
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_rate_details
@edit[:new][:details] = []
tiers = []
@rate ||= ChargebackRate.new
rate_details = @rate.chargeback_rate_details
- Create a ticketCreate a ticket