ManageIQ/manageiq-ui-classic

View on GitHub

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
Severity: Minor
Found in app/controllers/application_controller.rb - About 1 hr to fix

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
Severity: Minor
Found in app/controllers/report_controller/saved_reports.rb - About 1 hr to fix

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
Severity: Minor
Found in app/controllers/floating_ip_controller.rb - About 1 hr to fix

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)
Severity: Minor
Found in app/controllers/miq_request_controller.rb - About 1 hr to fix

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 = []

Severity: Minor
Found in app/presenters/tree_builder_catalog_items.rb - About 1 hr to fix

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,
Severity: Minor
Found in app/javascript/components/host-edit-form/host-edit-form.schema.js - About 1 hr to fix

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();

Severity: Minor
Found in app/javascript/oldjs/import.js - About 1 hr to fix

Function formCatalogData has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const formCatalogData = () => {
  const catalogData = {
    name: '',
    description: '',
    service_template_id: '',

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] = {
Severity: Minor
Found in app/javascript/components/reconfigure-vm-form/helpers/disk.js - About 1 hr to fix

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' },
Severity: Minor
Found in app/javascript/spec/settings-compan-categories/data.js - About 1 hr to fix

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) {
Severity: Minor
Found in app/javascript/components/workers-form/helpers.jsx - About 1 hr to fix

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');
Severity: Minor
Found in app/javascript/components/dashboard_toolbar.jsx - About 1 hr to fix

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
Severity: Minor
Found in app/controllers/application_controller/performance.rb - About 1 hr to fix

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"
Severity: Minor
Found in app/controllers/application_controller/ci_processing.rb - About 1 hr to fix

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)
Severity: Minor
Found in app/controllers/application_controller/ci_processing.rb - About 1 hr to fix

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
Severity: Minor
Found in app/controllers/application_controller/performance/options.rb - About 1 hr to fix

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])

Severity: Minor
Found in app/controllers/host_controller.rb - About 1 hr to fix

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]
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

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")

Severity: Minor
Found in app/controllers/ops_controller/settings/cap_and_u.rb - About 1 hr to fix

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
Severity: Minor
Found in app/controllers/chargeback_rate_controller.rb - About 1 hr to fix
Severity
Category
Status
Source
Language