ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method update has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update
    assert_privileges("miq_ae_class_edit")
    return unless load_edit("aeclass_edit__#{params[:id]}", "replace_cell__explorer")

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

Method upload_csv has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def upload_csv
    assert_privileges("region_edit")

    return unless load_edit("#{@sb[:active_tab]}_edit__#{@sb[:selected_server_id]}", "replace_cell__explorer")

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

Method rbac_user_delete has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def rbac_user_delete
    assert_privileges("rbac_user_delete")
    users = []
    if params[:id] # showing a list
      if params[:id].nil? || !User.exists?(:id => params[:id])
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.rb - About 1 hr to fix

Method determine_filter_type_and_value has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def determine_filter_type_and_value(schedule)
    if schedule.sched_action && schedule.sched_action[:method] && !schedule_automate(schedule)
      if schedule.miq_search # See if a search filter is attached
        filter_type = schedule.miq_search.search_type == "user" ? "my" : "global"
        filter_value = schedule.miq_search.id
Severity: Minor
Found in app/controllers/ops_controller/settings/schedules.rb - About 1 hr to fix

Method send_button_changes has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def send_button_changes
      if @edit
        @changed = (@edit[:new] != @edit[:current])
      elsif @assign
        @changed = (@assign[:new] != @assign[:current])
Severity: Minor
Found in app/controllers/mixins/policy_mixin.rb - About 1 hr to fix

Method set_record_vars has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_record_vars
    @edit[:set_assignments] = []
    if @edit[:new][:cbshow_typ].ends_with?("-tags")
      assigned_rates_from_all_categories = @edit[:cb_assign][:tags].values.reduce({}, :merge)
      assigned_rates_from_all_categories.each_key do |id|
Severity: Minor
Found in app/controllers/chargeback_assignment_controller.rb - About 1 hr to fix

Method gfv_charts has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def gfv_charts
    if params[:chosen_graph] && params[:chosen_graph] != @edit[:new][:graph_type]
      if params[:chosen_graph] == "<No chart>"
        @edit[:new][:graph_type] = nil
        # Reset other setting to initial settings if choosing <No chart>
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 1 hr to fix

Method features has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def features
    [
      {
        :role     => "miq_report_saved_reports",
        :role_any => true,
Severity: Minor
Found in app/controllers/report_controller.rb - About 1 hr to fix

Function adjustValidationStatus has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

var adjustValidationStatus = function(value, scope, ctrl, attrs, rootScope) {
  if (scope.checkAuthentication === true &&
     scope.postValidationModel !== undefined &&
     scope.postValidationModel[attrs.prefix] !== undefined) {
    var modelPostValidationObject = angular.copy(scope.postValidationModel[attrs.prefix]);

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

export const restructureCatalogData = function(catalogData, provisionCloudType, retirementCloudType) {
  let restructuredCatalogData = { ...catalogData };

  // adding specify_host_type field for both provision and retirement data
  if (Object.prototype.hasOwnProperty.call(restructuredCatalogData.config_info.provision, 'hosts')) {

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

const VmEditForm = ({
  recordId, emsId, displayName, isTemplate,
}) => {
  const [{
    initialValues, parentOptions, isLoading,
Severity: Minor
Found in app/javascript/components/vm-edit-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 CloudVolumeForm has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const CloudVolumeForm = ({ recordId, storageManagerId }) => {
  const [{ fields, initialValues, isLoading }, setState] = useState({ fields: [], isLoading: !!recordId || !!storageManagerId });
  const submitLabel = !!recordId ? __('Save') : __('Add');

  const loadSchema = (appendState = {}) => ({ data: { form_schema: { fields } } }) => {
Severity: Minor
Found in app/javascript/components/cloud-volume-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 DatastoreForm has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const DatastoreForm = ({
  type, domain, namespacePath, namespaceId, nameReadOnly, descReadOnly,
}) => {
  const isEdit = namespaceId !== 'new';
  const submitLabel = isEdit ? __('Save') : __('Add');
Severity: Minor
Found in app/javascript/components/data-store-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 menuItemOnClick has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const menuItemOnClick = (menuItems, widgetId, dataMethod, href, buttonTitle, widgetType, widgetTitle, setState, widgetModel, lastRun, nextRun) => {
  let index = 0;
  // Handles Minimize button and changes it to Maximize after click
  if (buttonTitle === __('Minimize')) {
    document.getElementById(`dd_w${widgetId}_box`).style.display = 'none';

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

const MiqAlertSetForm = ({ recordId, mode }) => {
  const [{
    fields, initialValues, isLoading, emsId, alertState, alertOptions,
  }, setState] = useState({
    fields: [],
Severity: Minor
Found in app/javascript/components/miq-alert-set-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

Method x_view_toolbar_filename has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def x_view_toolbar_filename
    if x_download_view_tb_render?
      'download_view_tb'
    elsif %w[miq_capacity_utilization].include?(@layout)
      'miq_capacity_view_tb'
Severity: Minor
Found in app/helpers/application_helper/toolbar_chooser.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 at_tree_select has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def at_tree_select(edit_key)
    id = parse_nodetype_and_id(params[:id]).last
    if params[:id].start_with?("aei-")
      record = MiqAeInstance.find_by(:id => id)
      @edit[:automate_tree_selected_path] = record.fqname
Severity: Minor
Found in app/helpers/automate_tree_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 textual_generate_openstack_status has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def textual_generate_openstack_status
    @record.service_group_names.collect do |x|
      running_count = @record.host_ids_with_running_service_group(x.name).count
      failed_count  = @record.host_ids_with_failed_service_group(x.name).count
      all_count     = @record.host_ids_with_service_group(x.name).count
Severity: Minor
Found in app/helpers/ems_cluster_helper/textual_summary.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 tagging_edit_tags_reset has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def tagging_edit_tags_reset
    get_tag_items if @explorer
    @object_ids = session[:tag_items]
    @sb[:rec_id] = params[:id] || session[:tag_items][0]
    @tagging = session[:tag_db].to_s
Severity: Minor
Found in app/controllers/application_controller/tags.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 tl_build_init_options has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def tl_build_init_options(refresh = nil)
    @tl_record = @record # Use related server vm record
    if @tl_options.nil? ||
       (refresh != "n" && params[:refresh] != "n" && @tl_options[:model] != @tl_record.class.base_class.to_s)
      @tl_options = Options.new
Severity: Minor
Found in app/controllers/application_controller/timelines.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