ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Method chart_fields_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def chart_fields_options
    chart_data_columns = if @edit[:new][:group] != 'No'
                           groupings = @edit[:new][:col_options].find_all do |_field, col_options|
                             col_options[:grouping].present? && !col_options[:grouping].empty?
                           end
Severity: Minor
Found in app/helpers/report_helper.rb - About 45 mins 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 update_from_miq_schedule has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def update_from_miq_schedule(run_at, timezone)
      self.typ    = run_at[:interval][:unit].titleize
      self.months = run_at[:interval][:value] if run_at[:interval][:unit] == 'monthly'
      self.weeks  = run_at[:interval][:value] if run_at[:interval][:unit] == 'weekly'
      self.days   = run_at[:interval][:value] if run_at[:interval][:unit] == 'daily'
Severity: Minor
Found in app/helpers/report_helper/timer.rb - About 45 mins 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 PxeCustomizationTemplateForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const PxeCustomizationTemplateForm = ({ recordId, copy }) => {
  const [{ initialValues, isLoading }, setState] = useState({ isLoading: !!recordId });
  const submitLabel = !!recordId ? __('Save') : __('Add');
  const disableSubmit = copy && copy !== recordId ? ['invalid'] : ['pristine'];

Severity: Minor
Found in app/javascript/components/pxe-customization-template-form/index.jsx - About 45 mins 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 select_by_roles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def select_by_roles(record)
    if record.instance_of?(ServerRole)
      data = {:mode => "selected_server_by_role_details"}
      rows = [{:cells => [{:icon => "ff ff-user-role settings-icn"}]},
              row_data(_('Role'), record.description)]
Severity: Minor
Found in app/helpers/ops_helper.rb - About 45 mins 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 TenantQuotaForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const TenantQuotaForm = ({ recordId }) => {
  const [{ initialValues, isLoading }, setState] = useState({ isLoading: !!recordId });
  const [enforced, setEnforced] = useState({});
  const [values, setValues] = useState({});
  const [disabled, setDisabled] = useState(true);
Severity: Minor
Found in app/javascript/components/tenant-quota-form/index.jsx - About 45 mins 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 subscribeToSubject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const subscribeToSubject = (dispatch) =>
  listenToRx(
    (event) => {
      if (event.toolbarEvent && (event.toolbarEvent === 'itemClicked')) {
        // TODO
Severity: Minor
Found in app/javascript/components/gtl-view.jsx - About 45 mins 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 widget_timer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def widget_timer(schedule, timezone, sb_data)
    if sb_data[:wtype] == "m"

      data = {:title => _('Timer'), :mode => "miq_widget_timer"}
      rows = []
Severity: Minor
Found in app/helpers/report_helper/report_dashboard_widget_helper.rb - About 45 mins 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 apply_common_props has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def apply_common_props(button, input)
    button.update(
      :color        => input[:color],
      :data         => button.data(input[:data]),
      :hidden       => button[:hidden] || !!input[:hidden],
Severity: Minor
Found in app/helpers/application_helper/toolbar_builder.rb - About 45 mins 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 custom_button_add_related_buttons has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def custom_button_add_related_buttons(model, record, toolbar)
    # For Service, we include buttons for ServiceTemplate.
    # These buttons are added as a single group with multiple buttons
    if record.kind_of?(Service)
      service_buttons = record_to_service_buttons(record)
Severity: Minor
Found in app/helpers/application_helper/toolbar_builder.rb - About 45 mins 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

Avoid deeply nested control flow statements.
Open

        return @lastaction == 'show_list' ? "#{@layout.pluralize}_center_tb" : "#{@layout}_center_tb"
Severity: Major
Found in app/helpers/application_helper/toolbar_chooser.rb - About 45 mins to fix

Method generic_button has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def generic_button(type, id, icon, title, text, keys)
Severity: Minor
Found in app/helpers/application_helper/toolbar/base.rb - About 45 mins to fix

Method custom_button_selects has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def custom_button_selects(model, record, toolbar_result)
    get_custom_buttons(model, record, toolbar_result).collect do |group|
      buttons = group[:buttons].collect { |b| create_custom_button(b, model, record) }

      enabled = if cb_send_checked_list
Severity: Minor
Found in app/helpers/application_helper/toolbar_builder.rb - About 45 mins 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

Avoid deeply nested control flow statements.
Open

      elsif @layout == "configuration_profile"
        return "configuration_profile_center_tb"
      elsif @layout == "configuration" && @tabform == "ui_4"
        return "time_profiles_center_tb"
      elsif @layout == "diagnostics"
Severity: Major
Found in app/helpers/application_helper/toolbar_chooser.rb - About 45 mins to fix

Method disabled? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def disabled?
    @error_message = if @record.master_supported?
                       if @record.priority == 1 || @record.priority == 2
                         if @view_context.x_node != "root" && @record.server_role.regional_role?
                           _("This role can only be managed at the Region level")
Severity: Minor
Found in app/helpers/application_helper/button/server_demote.rb - About 45 mins 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

Avoid deeply nested control flow statements.
Open

      if x_node == "root"
        return "iso_datastores_center_tb"
      elsif x_node_split.first == "isi"
        # on image node
        return "iso_image_center_tb"
Severity: Major
Found in app/helpers/application_helper/toolbar_chooser.rb - About 45 mins to fix

Method center_toolbar_name_vm_or_template has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def center_toolbar_name_vm_or_template
    if @record
      return "vm_performance_tb" if @display == "performance"

      case @record
Severity: Minor
Found in app/helpers/application_helper/toolbar_chooser.rb - About 45 mins 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 row_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def row_data(label, value, style = "", icon: false)
    if value.kind_of?(Array)
      {:cells => {:label => label, (icon ? :icon : :value) => [value[0], value[1]].join(', '), :color => style}}
    else
      {:cells => {:label => label, (icon ? :icon : :value) => value, :color => style}}
Severity: Minor
Found in app/helpers/shared_helper/ab_show_helper.rb - About 45 mins 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

Avoid deeply nested control flow statements.
Open

        if nodes.length == 2 && nodes[0] == "xx-ab"
          return "custom_button_set_center_tb"  # CI node is selected
        elsif (nodes.length == 1 && nodes[0].split('-').length == 3 && nodes[0].split('-')[1] == "ub") ||
              (nodes.length == 3 && nodes[0] == "xx-ab")
          return "custom_buttons_center_tb"     # group node is selected
Severity: Major
Found in app/helpers/application_helper/toolbar_chooser.rb - About 45 mins to fix

Method view_toolbar_filename has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def view_toolbar_filename
    if render_download_view_tb?
      'download_view_tb'
    elsif @lastaction == "compare_miq" || @lastaction == "compare_compress"
      'compare_view_tb'
Severity: Minor
Found in app/helpers/application_helper/toolbar_chooser.rb - About 45 mins 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

Avoid deeply nested control flow statements.
Open

    elsif x_active_tree == :widgets_tree
      node = x_node
      return node == "root" || node.split('-').length == 2 ? "miq_widgets_center_tb" : "miq_widget_center_tb"
Severity: Major
Found in app/helpers/application_helper/toolbar_chooser.rb - About 45 mins to fix
Severity
Category
Status
Source
Language