ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Avoid too many return statements within this method.
Open

        return
Severity: Major
Found in app/controllers/orchestration_stack_controller.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return if %w[orchestration_stack_retire orchestration_stack_tag].include?(params[:pressed]) &&
Severity: Major
Found in app/controllers/orchestration_stack_controller.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return
Severity: Major
Found in app/controllers/mixins/generic_button_mixin.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return
Severity: Major
Found in app/controllers/orchestration_stack_controller.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

          return
Severity: Major
Found in app/controllers/mixins/ems_common.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

          return
Severity: Major
Found in app/controllers/mixins/ems_common.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

          return
Severity: Major
Found in app/controllers/mixins/ems_common.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

          return
Severity: Major
Found in app/controllers/mixins/ems_common.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

          return
Severity: Major
Found in app/controllers/mixins/ems_common.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return if ["#{table_name}_tag", "#{display_s}_tag", "#{table_name}_protect", "#{display_s}_protect", "#{table_name}_timeline"].include?(params[:pressed]) &&
Severity: Major
Found in app/controllers/mixins/ems_common.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return
Severity: Major
Found in app/controllers/mixins/ems_common.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return
Severity: Major
Found in app/controllers/report_controller/saved_reports.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

    return record.title                      if record.respond_to?("title")
Severity: Major
Found in app/controllers/application_controller.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

    return validate_user_handle_not_ready(db_user) unless server_ready?
Severity: Major
Found in app/services/user_validation_service.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return ValidateResult.new(:fail, _("The user's role is not authorized for any access, please contact the administrator!"))
Severity: Major
Found in app/services/user_validation_service.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

    return validate_user_handle_no_records if db_user.super_admin_user? && no_records?
Severity: Major
Found in app/services/user_validation_service.rb - About 30 mins to fix

Function miqSetButtons has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

window.miqSetButtons = function(count, button_div) {
  if (button_div.match('_tb$') && count === 0) {
    // FIXME: this should be happening regardless of `count === 0`
    // ..but that needs more refactoring around miqUpdateAllCheckboxes, miqUpdateButtons, etc.
    miqSetToolbarCount(count);
Severity: Minor
Found in app/javascript/oldjs/miq_application.js - About 25 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 updateElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

ManageIQ.explorer.updateElement = function(element, options) {
  if (_.isString(options.legend)) {
    $('#' + element).html(options.legend);
  } else if (_.isString(options.title)) {
    $('#' + element).attr( {'title': options.title});
Severity: Minor
Found in app/javascript/oldjs/miq_explorer.js - About 25 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 asyncValidator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const asyncValidator = (value = '', ancestry, itemId) =>
  API.get(`/api/tenants?filter[]=name=${value}&expand=resources`)
    .then((json) => {
      if (json.resources.find(({ id, name }) => name === value && id !== itemId)) {
        throw __('Name has already been taken');
Severity: Minor
Found in app/javascript/components/ops-tenant-form/ops-tenant-form.schema.js - About 25 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 getFirewallRules has a Cognitive Complexity of 6 (exceeds 5 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: Minor
Found in app/javascript/components/network-security-groups-form/helper.js - About 25 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

Severity
Category
Status
Source
Language