ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

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

window.validateMinMax = function(min, max, minShowed, maxShowed) {
  var invalid = false;
  // if there are no valid values or there is only single values big enough, then not change formating function
  if (max <= min || maxShowed < minShowed) {
    if (max < min || max > 10) {
Severity: Minor
Found in app/javascript/oldjs/miq_c3.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

Avoid deeply nested control flow statements.
Open

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

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

window.miqBuildChartMenuEx = function(col, row, _value, category, series, chart_set, chart_index) {
  const chart_data = ManageIQ.charts.chartData[chart_set];
  const chart_el = $(`#miq_chart_parent_${chart_set}_${chart_index}`);
  const chartmenu_el = $(`#miq_chartmenu_${chart_set}_${chart_index}`);
  chartmenu_el.empty();
Severity: Minor
Found in app/javascript/oldjs/miq_application.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

Avoid deeply nested control flow statements.
Open

          if (rule.direction === undefined) {
            rule.direction = 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_ip_range === undefined) {
            rule.source_ip_range = null;
          }
Severity: Major
Found in app/javascript/components/network-security-groups-form/helper.js - About 45 mins to fix

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

const customJsAction = ({ action }) => {
  switch (action.name) {
    case 'miqTreeActivateNode':
      if (action.nodeTree && action.nodeKey) {
        window.miqTreeActivateNode(action.nodeTree, action.nodeKey);
Severity: Minor
Found in app/javascript/helpers/custom-click-handler.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 add_flash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

window.add_flash = function(msg, level, options) {
  level = level || 'success';
  options = options || {};
  var cls = { alert: '', icon: '' };

Severity: Minor
Found in app/javascript/oldjs/miq_flash.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

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

Severity
Category
Status
Source
Language