ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Avoid deeply nested control flow statements.
Open

          if (rule.host_protocol === undefined) {
            rule.host_protocol = null;
          }
Severity: Major
Found in app/javascript/components/network-security-groups-form/helper.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (rule.source_security_group_id === undefined || rule.source_security_group_id === null) {
            rule.source_security_group_id = null;
          } else {
            rule.source_ip_range = '';
          }
Severity: Major
Found in app/javascript/components/network-security-groups-form/helper.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (rule.network_protocol === undefined) {
            rule.network_protocol = null;
          }
Severity: Major
Found in app/javascript/components/network-security-groups-form/helper.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

              if (values.selectedItems[i].value !== 'all') {
                tempItems.push(values.selectedItems[i]);
              }
Severity: Major
Found in app/javascript/components/multiselect-with-selectall/index.js - About 45 mins to fix

Function setDiskFormSubmit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const setDiskFormSubmit = (data, setData, formData, roles, renderData) => {
  const dataTableData = data.dataTable.disks || [];
  if (data.form.action === 'add') {
    // code for add
    const id = `disk${dataTableData.length}`;
Severity: Minor
Found in app/javascript/components/reconfigure-vm-form/helpers/disk.js - About 45 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 HostInitiatorGroupForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in app/javascript/components/host-initiator-group-form/index.jsx - About 45 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 formatSetData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const formatSetData = (setData, buttonIcon, appliesToClass, appliesToId, groupIndex) => {
  if (appliesToId) {
    return ({
      ...setData,
      button_color: (setData && setData.button_color) ? setData.button_color : '#000',
Severity: Minor
Found in app/javascript/components/button-group/helper.js - About 45 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 getInitialValues has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const getInitialValues = (ownershipItems) => new Promise((resolve) => {
  if (ownershipItems.length > 1) {
    resolve({ group: 'dont-change', user: 'dont-change' });
  } else if (ownershipItems.length === 1) {
    const item = ownershipItems[0];
Severity: Minor
Found in app/javascript/components/set-ownership-form/index.jsx - About 45 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 prepareRequestObject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const prepareRequestObject = (values, formId) => {
  const requestObject = { ...values };

  // if price property is not there add price property if its present convert the value into string
  if (!Object.prototype.hasOwnProperty.call(requestObject, 'price')) {
Severity: Minor
Found in app/javascript/components/terraform-template-catalog-form/helper.js - About 45 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 createSchema has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const createSchema = (state, setState, ems, initialValues, storageId, setStorageId) => {
  let emsId = state.ems_id;
  if (initialValues && initialValues.ems_id) {
    emsId = initialValues.ems_id;
  }

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

export const notificationReducer = (state = notificationInitialState, action) => {
  switch (action.type) {
    case INIT_NOTIFICATIONS:
      return {
        ...state,
Severity: Minor
Found in app/javascript/miq-redux/notification-reducer.js - About 45 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 dataHelper has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const dataHelper = (values, timeProfileId, action, userid) => {
  let data = {};
  let APIaction = 'edit';
  let metrics = values.rollup_daily_metrics;
  let profileType = values.profile_type;
Severity: Minor
Found in app/javascript/components/settings-time-profile-form/helper.js - About 45 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 model has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const model = (isLoading, widgetId, widgetModel, widgetType) => {
  let widget;
  if (isLoading) {
    widget = (
      <div className="loadingSpinner">
Severity: Minor
Found in app/javascript/components/dashboard-widgets/widget-wrapper/helper.jsx - About 45 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

Method chart_fields_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def chart_fields_options
    chart_data_columns = if @edit[:new][:group] != 'No'
                           groupings = @edit[:new][:col_options].find_all do |_field, col_options|
                             col_options[:grouping].present? && !col_options[:grouping].empty?
                           end
Severity: Minor
Found in app/helpers/report_helper.rb - About 45 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

Method update_from_miq_schedule has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def update_from_miq_schedule(run_at, timezone)
      self.typ    = run_at[:interval][:unit].titleize
      self.months = run_at[:interval][:value] if run_at[:interval][:unit] == 'monthly'
      self.weeks  = run_at[:interval][:value] if run_at[:interval][:unit] == 'weekly'
      self.days   = run_at[:interval][:value] if run_at[:interval][:unit] == 'daily'
Severity: Minor
Found in app/helpers/report_helper/timer.rb - About 45 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 PxeCustomizationTemplateForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const PxeCustomizationTemplateForm = ({ recordId, copy }) => {
  const [{ initialValues, isLoading }, setState] = useState({ isLoading: !!recordId });
  const submitLabel = !!recordId ? __('Save') : __('Add');
  const disableSubmit = copy && copy !== recordId ? ['invalid'] : ['pristine'];

Severity: Minor
Found in app/javascript/components/pxe-customization-template-form/index.jsx - About 45 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

Method select_by_roles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def select_by_roles(record)
    if record.instance_of?(ServerRole)
      data = {:mode => "selected_server_by_role_details"}
      rows = [{:cells => [{:icon => "ff ff-user-role settings-icn"}]},
              row_data(_('Role'), record.description)]
Severity: Minor
Found in app/helpers/ops_helper.rb - About 45 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 TenantQuotaForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const TenantQuotaForm = ({ recordId }) => {
  const [{ initialValues, isLoading }, setState] = useState({ isLoading: !!recordId });
  const [enforced, setEnforced] = useState({});
  const [values, setValues] = useState({});
  const [disabled, setDisabled] = useState(true);
Severity: Minor
Found in app/javascript/components/tenant-quota-form/index.jsx - About 45 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 subscribeToSubject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const subscribeToSubject = (dispatch) =>
  listenToRx(
    (event) => {
      if (event.toolbarEvent && (event.toolbarEvent === 'itemClicked')) {
        // TODO
Severity: Minor
Found in app/javascript/components/gtl-view.jsx - About 45 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

Method widget_timer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def widget_timer(schedule, timezone, sb_data)
    if sb_data[:wtype] == "m"

      data = {:title => _('Timer'), :mode => "miq_widget_timer"}
      rows = []
Severity: Minor
Found in app/helpers/report_helper/report_dashboard_widget_helper.rb - About 45 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