ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method upload_csv has a Cognitive Complexity of 17 (exceeds 5 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 2 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 update_method has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def update_method
    assert_privileges("miq_ae_method_edit")
    return unless load_edit("aemethod_edit__#{params[:id]}", "replace_cell__explorer")

    get_method_form_vars
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 2 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 miq_policy_edit_conditions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def miq_policy_edit_conditions
    assert_privileges('miq_policy_conditions_assignment')
    case params[:button]
    when "cancel"
      @sb[:action] = @edit = nil
Severity: Minor
Found in app/controllers/miq_policy_controller/policies.rb - About 2 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 rbac_group_user_lookup has a Cognitive Complexity of 17 (exceeds 5 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 2 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 live_migrate_vm has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        def live_migrate_vm
          assert_privileges("instance_live_migrate")
          case params[:button]
          when "cancel"
            add_flash(_("Live migration of Instances was cancelled by the user"))
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/live_migrate.rb - About 2 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 set_rate_details has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def set_rate_details
    @edit[:new][:details] = []
    tiers = []
    @rate ||= ChargebackRate.new
    rate_details = @rate.chargeback_rate_details
Severity: Minor
Found in app/controllers/chargeback_rate_controller.rb - About 2 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 validate_snmp_options has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_snmp_options(options)
      if options[:host].nil? || options[:host] == ""
        add_flash(_("Host is required"), :error)
      end

Severity: Minor
Found in app/controllers/mixins/policy_mixin.rb - About 2 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 set_record_vars_ovf_template has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def set_record_vars_ovf_template
    options = {}
    options[:name] = @edit[:new][:name]
    options[:description] = @edit[:new][:description]
    options[:long_description] = @edit[:new][:display] ? @edit[:new][:long_description] : nil
Severity: Minor
Found in app/controllers/catalog_controller.rb - About 2 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 set_form_vars has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def set_form_vars
    @edit[:new][:name] = @record.name
    @edit[:new][:description] = @record.description
    @edit[:new][:long_description] = @record.long_description
    @edit[:new][:provision_cost] = @record.provision_cost
Severity: Minor
Found in app/controllers/catalog_controller.rb - About 2 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 gfv_charts has a Cognitive Complexity of 17 (exceeds 5 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 2 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 menu_repname_update has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def menu_repname_update(old_name, new_name)
    # @param old_name [String] old name for the report
    # @param new_name [String, Nil] new name for the report. nil if it was deleted

    all_roles = MiqGroup.non_tenant_groups_in_my_region
Severity: Minor
Found in app/controllers/report_controller/reports.rb - About 2 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 edit_folder has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def edit_folder
    if params[:button] == "reset" || params[:button] == "default" # resetting node in case reset button is pressed
      session[:node_selected] = "xx-b__Report Menus for #{session[:role_choice]}"
    end

Severity: Minor
Found in app/controllers/report_controller/menus.rb - About 2 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 show has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    super
    @alert = @record
    @email_to = []
    if @alert.responds_to_events == "_hourly_timer_"
Severity: Minor
Found in app/controllers/miq_alert_controller.rb - About 2 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 miqExpressionPrefill has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  window.miqExpressionPrefill = function(expEditor, noPrefillCount) {
    let title;

    if ($('#chosen_value[type=text]').length) {
      $('#chosen_value').prop('placeholder', expressions[expEditor.first.type]);
Severity: Major
Found in app/javascript/oldjs/miq_application.js - About 2 hrs to fix

Function newInstance has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function newInstance(name, initialProps = {}, mountTo = undefined) {
  // clean all left over components
  cleanVirtualDom();
  // validate inputs
  const definition = getDefinition(name);
Severity: Major
Found in app/javascript/miq-component/registry.js - About 2 hrs to fix

Function getFirewallRules has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const getFirewallRules = (initialValues, values, securityGroupId) => {
  const oldFirewallRuleIds = [];
  const temp = { firewall_rules: [], firewall_rules_delete: false };

  if (values.firewall_rules.length > 0 || initialValues.firewall_rules.length > 0) {
Severity: Major
Found in app/javascript/components/network-security-groups-form/helper.js - About 2 hrs to fix

Function catalogData has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const catalogData = () => {
  const columns = [
    { is_narrow: true, header_text: '' },
    {
      text: 'Name', sort: 'str', col_idx: 0, align: 'left', header_text: 'Name',
Severity: Major
Found in app/javascript/spec/miq-data-table/data.js - About 2 hrs to fix

Function CodeEditor has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CodeEditor = (props) => {
  const {
    labelText,
    input: { value, onChange, name },
    FormGroupProps,
Severity: Major
Found in app/javascript/components/code-editor/index.js - About 2 hrs to fix

Method perf_util_summary_section has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perf_util_summary_section(s)
    ss = []

    # Fill in the single day data from the timestamp report
    ts_rpt = @sb[:ts_rpt]
Severity: Major
Found in app/controllers/application_controller/performance.rb - About 2 hrs to fix

Method data_for_breadcrumbs has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def data_for_breadcrumbs(controller_options = {})
      options = breadcrumbs_options || {}
      options[:record_info] ||= (@record || {})
      options[:record_title] ||= :name
      options[:not_tree] ||= false
Severity: Major
Found in app/controllers/mixins/breadcrumbs_mixin.rb - About 2 hrs to fix
Severity
Category
Status
Source
Language