ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Function SubnetForm has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

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

  const loadSchema = (appendState = {}) => ({ data: { form_schema: { fields } } }) => {
Severity: Minor
Found in app/javascript/components/subnet-form/index.jsx - About 3 hrs 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 perf_gen_top_data_before_wait has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def perf_gen_top_data_before_wait
    @perf_options[:ght_type] ||= "hybrid"
    @perf_options[:chart_type] = :performance
    cont_plus_model = request.parameters["controller"] + "-" + @perf_options[:top_model]
    metric_model = @perf_options[:top_model] == "Vm" ? "VmOrTemplate" : @perf_options[:top_model]
Severity: Minor
Found in app/controllers/application_controller/performance.rb - About 3 hrs 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 button has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def button
    @edit = session[:edit]                                  # Restore @edit for adv search box
    params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh
    @refresh_div = "main_div"                               # Default div for button.rjs to refresh

Severity: Minor
Found in app/controllers/vm_common.rb - About 3 hrs 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 button has a Cognitive Complexity of 22 (exceeds 5 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 3 hrs 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 deleteemss has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def deleteemss
      assert_privileges(params[:pressed])
      emss = []
      if @lastaction == "show_list" # showing a list, scan all selected emss
        emss = find_checked_items
Severity: Minor
Found in app/controllers/mixins/ems_common.rb - About 3 hrs 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 schedule_form_field_changed has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def schedule_form_field_changed
    assert_privileges(@edit && @edit[:rpt_id] ? "miq_report_schedule_edit" : "miq_report_schedule_add")

    return unless load_edit("schedule_edit__#{params[:id]}", "replace_cell__explorer")
    schedule_get_form_vars
Severity: Minor
Found in app/controllers/report_controller/schedules.rb - About 3 hrs 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 stamp has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def stamp
    assert_privileges(rbac_feature_id("miq_request_approval"))
    if params[:button] == "cancel"
      if (session[:edit] && session[:edit][:stamp_typ]) == "a"
        flash_to_session(_("Request approval was cancelled by the user"))
Severity: Minor
Found in app/controllers/miq_request_controller.rb - About 3 hrs 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_validate_entries has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def widget_validate_entries
    if %w[r c].include?(@sb[:wtype]) && (!@edit[:new][:repfilter] || @edit[:new][:repfilter] == "")
      add_flash(_("A Report must be selected"), :error)
    end
    if %w[role group].include?(@edit[:new][:visibility_typ])
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 3 hrs 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 link has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    link: function(scope, elem, attr, ctrl) {
      scope['formchange_' + ctrl.$name] = elem[0].name;
      scope['elemType_' + ctrl.$name] = attr.type;

      var model = function() {
Severity: Major
Found in app/javascript/oldjs/directives/checkchange.js - About 3 hrs to fix

Method atomic_form_field_changed has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def atomic_form_field_changed
    assert_privileges(session&.fetch_path(:edit, :rec_id) ? "atomic_catalogitem_edit" : "atomic_catalogitem_new")

    # need to check req_id in session since we are using common code for prov requests and atomic ST screens
    id = session[:edit][:req_id] || "new"
Severity: Major
Found in app/controllers/catalog_controller.rb - About 3 hrs to fix

Method valid_report? has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def valid_report?(rpt)
    active_tab = 'edit_1'
    if @edit[:new][:model] == ApplicationController::TREND_MODEL
      unless @edit[:new][:perf_trend_col]
        add_flash(_('Trending for is required'), :error)
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 3 hrs to fix

Function getNetworkChart has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const getNetworkChart = (isLoading, dashboardData) => {
  if (isLoading !== true) {
    if (dashboardData.data.network_metrics.dataAvailable) {
      const chartData = [];
      let count = 0;
Severity: Major
Found in app/javascript/components/container-projects/helper.jsx - About 3 hrs to fix

Method set_global_session_data has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_global_session_data
    @sb ||= {}
    # Set all of the global variables used by most of the controllers
    session[:layout] = @layout
    session[:panels] = @panels
Severity: Major
Found in app/controllers/application_controller.rb - About 3 hrs to fix

Function setConfigInfo has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var setConfigInfo = function(configData) {
    var catalog_item = {
      name: configData.name,
      description: configData.description,
      long_description: configData.long_description,

Class EmsInfraController has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

class EmsInfraController < ApplicationController
  include Mixins::GenericListMixin
  include Mixins::GenericShowMixin
  include Mixins::EmsCommon # common methods for EmsInfra/Cloud controllers
  include Mixins::DashboardViewMixin
Severity: Minor
Found in app/controllers/ems_infra_controller.rb - About 3 hrs to fix

Function getMemoryChart has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const getMemoryChart = (isLoading, dashboardData) => {
  if (isLoading !== true) {
    if (dashboardData.data.project_utilization.dataAvailable) {
      const chartData = [];
      let count = 0;
Severity: Major
Found in app/javascript/components/container-projects/helper.jsx - About 2 hrs to fix

Function getCPUChart has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const getCPUChart = (isLoading, dashboardData) => {
  if (isLoading !== true) {
    if (dashboardData.data.project_utilization.dataAvailable) {
      const chartData = [];
      let count = 0;
Severity: Major
Found in app/javascript/components/container-projects/helper.jsx - About 2 hrs to fix

Method build_schedule_options_for_select has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def build_schedule_options_for_select
    @action_type_options_for_select = [
      [_("VM Analysis"), "vm"],
      [_("Template Analysis"), "miq_template"],
      [_("Host Analysis"), "host"],
Severity: Major
Found in app/controllers/ops_controller/settings/schedules.rb - About 2 hrs to fix

Function onSubmit has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const onSubmit = (values) => {
    // Compares initialValues and values and returns the value only if it's different
    const isDifferent = (name) => (get(initialValues, name) !== get(values, name) ? get(values, name) : undefined);

    miqSparkleOn();
Severity: Major
Found in app/javascript/components/workers-form/workers-form.jsx - About 2 hrs to fix

Method schedule_edit has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def schedule_edit
    assert_privileges("schedule_edit")
    case params[:button]
    when "cancel"
      @schedule = MiqSchedule.find_by(:id => params[:id])
Severity: Major
Found in app/controllers/ops_controller/settings/schedules.rb - About 2 hrs to fix
Severity
Category
Status
Source
Language