ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method set_session_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def set_session_data
      session[:vm_lastaction]   = @lastaction
      session[:vm_showtype]     = @showtype
      session[:miq_compressed]  = @compressed unless @compressed.nil?
      session[:miq_exists_mode] = @exists_mode unless @exists_mode.nil?
Severity: Minor
Found in app/controllers/mixins/vm_show_mixin.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 set_session_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def set_session_data
    session[:vm_lastaction]   = @lastaction
    session[:vm_showtype]     = @showtype
    session[:miq_compressed]  = @compressed unless @compressed.nil?
    session[:miq_exists_mode] = @exists_mode unless @exists_mode.nil?
Severity: Minor
Found in app/controllers/vm_controller.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 set_variables_report_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def set_variables_report_data(settings, current_view)
    settings[:sort_dir] = @sortdir unless settings.nil?
    settings[:sort_col] = @sortcol unless settings.nil?
    @edit = session[:edit]
    @policy_sim = @edit[:policy_sim] unless @edit.nil?
Severity: Minor
Found in app/controllers/application_controller.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 import has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def import
    assert_privileges('policy_import_export')
    @breadcrumbs = []
    @layout = "miq_policy_export"
    @import_file_upload_id = params[:import_file_upload_id]
Severity: Minor
Found in app/controllers/miq_policy_export_controller.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 build_audit_payload_changes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def build_audit_payload_changes(new, current)
    if current
      current = current.deep_clone
      diff = Vmdb::Settings::HashDiffer.diff(current, new)
      Vmdb::Settings.mask_passwords!(current)
Severity: Minor
Found in app/controllers/application_controller.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 export has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def export
    assert_privileges('policy_import_export')
    @breadcrumbs = []
    @layout = "miq_policy_export"
    drop_breadcrumb(:name => _("Import / Export"), :url => "miq_policy_export")
Severity: Minor
Found in app/controllers/miq_policy_export_controller.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 show_preview has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def show_preview
    assert_privileges(session.fetch_path(:edit, :rpt_id) ? "miq_report_edit" : "miq_report_new")

    unless params[:task_id]                       # First time thru, kick off the report generate task
      @rpt = create_report_object                 # Build a report object from the latest edit fields
Severity: Minor
Found in app/controllers/report_controller/reports.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 condition_build_edit_screen has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def condition_build_edit_screen
    @edit = {}
    @edit[:new] = {}
    @edit[:current] = {}

Severity: Minor
Found in app/controllers/condition_controller.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 set_config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def set_config(db_record)
    @cluster_config = []
    unless db_record.ha_enabled.nil?
      @cluster_config.push(:field       => "HA Enabled",
                           :description => db_record.ha_enabled)
Severity: Minor
Found in app/controllers/ems_cluster_controller.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 key has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def key
      if @object.try(:id).nil?
        # FIXME: this makes problems in tests
        # to handle "Unassigned groups" node in automate buttons tree
        "-#{@object.name.split('|').last}"
Severity: Minor
Found in app/presenters/tree_node/node.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 build_expression_vars has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def build_expression_vars
    @edit[:new][:expression] = @condition.expression.kind_of?(MiqExpression) ? @condition.expression.exp : nil
    @edit[:new][:applies_to_exp] = @condition.applies_to_exp.kind_of?(MiqExpression) ? @condition.applies_to_exp.exp : nil

    # Populate exp editor fields for the expression column
Severity: Minor
Found in app/controllers/condition_controller.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 create_custom_menu_section has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def create_custom_menu_section(properties)
      icon         = properties.key?('icon') ? properties['icon'] : nil
      placement    = properties.key?('placement') ? properties['placement'].to_sym : :default
      before       = properties.key?('before') ? properties['before'].to_sym : nil
      section_type = properties.key?('section_type') ? properties['section_type'].to_sym : :default
Severity: Minor
Found in app/presenters/menu/yaml_loader.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

Function load_c3_chart has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.load_c3_chart = function(data, chart_id, height) {
  if (typeof (data.miqChart) === 'undefined') {
    data.miqChart = 'Line';
  }

Severity: Minor
Found in app/javascript/oldjs/miq_c3.js - About 1 hr to fix

Function recalculateChartYAxisLabels has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.recalculateChartYAxisLabels = function(id) {
  // hide/show chart with id
  this.api.toggle(id);

  var minMax = getMinMaxFromChart(this);
Severity: Minor
Found in app/javascript/oldjs/miq_c3.js - About 1 hr to fix

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

  var setConfigInfo = function(configData) {
    var method = {
      name: configData.name,
      display_name: configData.display_name,
      class_id: configData.class_id,
Severity: Minor
Found in app/javascript/angular/miq_ae_class/ae_method_form_controller.js - About 1 hr to fix

Function miqHttpInject has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function miqHttpInject(angular_app) {
  angular_app.config(['$locationProvider', function($locationProvider) {
    /**
     * hashPrefix must be empty othervise it will conflict with HashRouter and create infinite loop
     * React HashRouter can be configured to have hashbang prefix,
Severity: Minor
Found in app/javascript/oldjs/miq_angular_application.js - About 1 hr to fix

Function number_with_delimiter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function number_with_delimiter(val, options) {
    options = _.extend({ delimiter: ',', separator: '.' }, options || {});
    var intpart;
    var floatpart;
    var minus;
Severity: Minor
Found in app/javascript/oldjs/miq_formatters.js - About 1 hr to fix

Function convertMultParamsToRailsMultParams has 27 lines of code (exceeds 25 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

Function setupForm has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const setupForm = (initialValues, resources, name) => {
  const modifiedInitialValues = {
    name, values: [], enforced: [], invalid: [], ...initialValues,
  };

Severity: Minor
Found in app/javascript/components/tenant-quota-form/helper.js - About 1 hr to fix

Function loadvalues has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const loadvalues = (values) => {
    let stop = false;
    if (!allitems && values.selectedItems.length === options.length - 1) {
      setAllItems(true);
      values.selectedItems.push({ value: 'all', label: 'SELECT ALL' });
Severity: Minor
Found in app/javascript/components/multiselect-with-selectall/index.js - About 1 hr to fix
Severity
Category
Status
Source
Language