ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Function gtlReducer has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const gtlReducer = (state, action) => {
  switch (action.type) {
    case 'dataLoaded':
      if (state && state.additionalOptions && state.additionalOptions.checkboxes_clicked
        && state.additionalOptions.checkboxes_clicked.length === 0) {
Severity: Minor
Found in app/javascript/components/gtl-view.jsx - About 1 hr to fix

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

  def textual_group_endpoints
    endpoints = @record.endpoints.where.not(:role => 'default')
    return if endpoints.nil?

    endpoints_types = {
Severity: Minor
Found in app/helpers/ems_container_helper/textual_summary.rb - About 1 hr to fix

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

  def policy_build_edit_screen(edit_type = nil)
    @edit = {}
    @edit[:new] = {}
    @edit[:current] = {}
    @edit[:key] = "miq_policy_edit__#{@policy.id || "new"}"
Severity: Minor
Found in app/controllers/miq_policy_controller/policies.rb - About 1 hr to fix

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

  def fields_seq_edit
    assert_privileges("miq_ae_field_seq")
    case params[:button]
    when "cancel"
      @sb[:action] = session[:edit] = nil # clean out the saved info
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

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

  def rbac_group_user_lookup
    assert_privileges(params[:id] == "new" ? "rbac_group_add" : "rbac_group_edit")


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

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

  def build_filtered_item_list(action_type, filter_type)
    case filter_type
    when "vm"
      filtered_item_list = find_filtered(Vm).sort_by { |vm| vm.name.downcase }.collect(&:name).uniq
    when "miq_template"
Severity: Minor
Found in app/controllers/ops_controller/settings/schedules.rb - About 1 hr to fix

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

Severity
Category
Status
Source
Language