ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Method button has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def button
      @edit = session[:edit] # Restore @edit for adv search box
      params[:display] = @display if %w[vms images instances].include?(@display)
      params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh

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

Method pxe_wimg_edit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def pxe_wimg_edit
    assert_privileges("pxe_wimg_edit")
    case params[:button]
    when "cancel"
      add_flash(_("Edit of Windows Image \"%{name}\" was cancelled by the user") % {:name => session[:edit][:wimg].name})
Severity: Minor
Found in app/controllers/pxe_controller/pxe_servers.rb - About 1 hr to fix

Method explorer has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def explorer
      @explorer = true
      @lastaction = "explorer"
      @timeline = @timeline_filter = true # need to set these to load timelines on vm show screen
      if params[:menu_click]              # Came in from a chart context menu click
Severity: Minor
Found in app/controllers/mixins/vm_show_mixin.rb - About 1 hr to fix

Method move_cols_left has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def move_cols_left
    if params[:selected_fields].blank? || params[:selected_fields][0] == ""
      add_flash(_("No fields were selected to move up"), :error)
    elsif display_filter_contains?(params[:selected_fields])
      add_flash(_("No fields were moved up"), :error)
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 1 hr to fix

Method get_global_session_data has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_global_session_data
    # Set the current userid in the User class for this thread for models to use
    User.current_user = current_user
    # if session group for user != database group for the user then ensure it is a valid group
    if current_user.try(:current_group_id_changed?) && !current_user.miq_groups.include?(current_group)
Severity: Minor
Found in app/controllers/application_controller.rb - About 1 hr to fix

Method set_form_locals has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_form_locals
    locals = {}
    if x_active_tree == :export_tree
      locals[:no_reset] = locals[:no_cancel] = locals[:multi_record] = true
      if x_node == "xx-exportwidgets"
Severity: Minor
Found in app/controllers/report_controller.rb - About 1 hr to fix

Method widget_form_field_changed has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def widget_form_field_changed
    assert_privileges(feature_for_widget_action)

    return unless load_edit("widget_edit__#{params[:id]}", "replace_cell__explorer")
    widget_get_form_vars
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 1 hr to fix

Function prepareRequestObject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export const prepareRequestObject = (values, formId) => {
  const requestObject = { ...values };

  // if price property is not there add price property if its present convert the value into string
  if (!Object.prototype.hasOwnProperty.call(requestObject, 'price')) {

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 actionsToFunction has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  actionsToFunction: function() {
    var startEnd = function(pageNumber) {
      var start = (pageNumber - 1) * this.settings.perpage;
      var end = start + this.settings.perpage;
      return {
Severity: Minor
Found in app/javascript/oldjs/miq_qe.js - 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 getTextValue has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const getTextValue = (cellValue) => {
  if (isNull(cellValue)) {
    return '';
  }
  if (isObject(cellValue)) {
Severity: Minor
Found in app/javascript/components/miq-data-table/helper.js - 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 normalize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const normalize = (tree, fn) => tree.map((n) => {
  let node = { ...n };
  if (node.class) {
    node = { ...node, classes: node.class };
    delete node.class;
Severity: Minor
Found in app/javascript/components/tree-view/helpers.js - 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 linkProps has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export const linkProps = ({
  type, href, id, hideSecondary = () => null,
}) => ({
  href: {
    big_iframe: `/dashboard/iframe?id=${id}`,
Severity: Minor
Found in app/javascript/menu/item-type.js - 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 convertMultParamsToRailsMultParams has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function convertMultParamsToRailsMultParams(fullParamString) {
  const keyValuePairsArr = [];
  if (fullParamString) {
    fullParamString.split('&').forEach((element) => {
      if (element) {
Severity: Minor
Found in app/javascript/toolbar-actions/util.js - 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 NetworkFloatingIPsForm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const NetworkFloatingIPsForm = ({
  recordId,
}) => {
  const [{
    ems, initialValues, isLoading, fields,
Severity: Minor
Found in app/javascript/components/network-floatingIPs-form/index.jsx - 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 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

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|
Severity: Minor
Found in app/helpers/application_helper/toolbar_builder.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 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 = []
Severity: Minor
Found in app/helpers/miq_ae_class_helper.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 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|
Severity: Minor
Found in app/helpers/catalog_helper.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 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)
Severity: Minor
Found in app/helpers/chargeback_rate_helper.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 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)
Severity: Minor
Found in app/controllers/application_controller/ci_processing.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

Severity
Category
Status
Source
Language