ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

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

window.miqTreeScrollToNode = function(tree, id) {
  var node = miqTreeFindNodeByKey(tree, id);
  var parentPanelBody = node.$el.parents('div.panel-body');
  if (parentPanelBody.length > 0) {
    // Calculate the current node position relative to the scrollable panel
Severity: Minor
Found in app/javascript/oldjs/miq_tree.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 logError has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

window.logError = function(fn) {
  return function(text) {
    try {
      return fn(text);
    } catch (ex) {
Severity: Minor
Found in app/javascript/oldjs/jquery_overrides.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 loadTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const loadTable = (values, tz, users) => {
  const filters = [];
  const {
    zone, timePeriod, taskStatus, taskState, user,
  } = values; // User selected values
Severity: Minor
Found in app/javascript/components/settings-tasks-form/load-table-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

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

window.miqBuildChartMenu = function(col, row, _value, category, series, id, _message) {
  const set = id.split('_')[1]; // Get the chart set
  const idx = id.split('_')[2]; // Get the chart index
  const chart_data = ManageIQ.charts.chartData[set];
  const chart_el_id = id.replace(/^miq_/, 'miq_chart_');
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 createSchema has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const createSchema = (fields, edit, ems, loadSchema, emptySchema) => {
  const idx = fields.findIndex((field) => field.name === 'required_capabilities');
  const supports = edit ? 'supports_storage_services' : 'supports_storage_service_create';
  let providerCapabilities;

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 6 (exceeds 5 allowed). Consider refactoring.
Open

const createSchema = (fields, edit, ems, loadSchema, emptySchema) => {
  const idx = fields.findIndex((field) => field.name === 'volume_type');
  const supports = edit ? 'supports_cloud_volume' : 'supports_cloud_volume_create';
  let providerCapabilities;

Severity: Minor
Found in app/javascript/components/cloud-volume-form/cloud-volume-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 recalculateChartYAxisLabels has a Cognitive Complexity of 6 (exceeds 5 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 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 ServersDataChart has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ServersDataChart = ({
  providerId, serversAvailableConfig, serversHealthConfig, title, apiUrl,
}) => {
  const [data, setCardData] = useState({ loading: true });

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

const ReportDataTable = (props) => {
  const { perPageDefault, perPageOptions, reportType } = props;
  const initState = {
    ...initialState,
    pagination: {

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

const PasswordField = ({
  cancelEditLabel,
  changeEditLabel,
  helperText,
  edit,
Severity: Minor
Found in app/javascript/components/async-credentials/password-field.jsx - 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 generateRefreshOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const generateRefreshOptions = (constrained = false, initialStep = 50, initialIndex = 200) => {
  let index = initialIndex;
  let step = initialStep;
  const options = [];
  while (index < 1000) {
Severity: Minor
Found in app/javascript/components/workers-form/helpers.jsx - 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 wait_for_task has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

API.wait_for_task = (taskId) => {
  const deferred = miqDeferred();

  const retry = () => {
    API.get(`/api/tasks/${taskId}?attributes=task_results`)
Severity: Minor
Found in app/javascript/http_api/api.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 getPodsTrendChart has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getPodsTrendChart = (isLoading, dashboardData) => {
  if (isLoading !== true) {
    if (dashboardData.data.pod_metrics.dataAvailable) {
      const tooltipType = dashboardData.data.pod_metrics.interval_name;
      let config = 'hourlyPodUsageConfig';
Severity: Minor
Found in app/javascript/components/container-projects/helper.jsx - 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 MultiSelectWithSelectAll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const MultiSelectWithSelectAll = (props) => {
  const {
    initialValues, options, id, titleText, label, placeholder,
    ...rest
  } = useFieldApi(prepareProps(props));
Severity: Minor
Found in app/javascript/components/multiselect-with-selectall/index.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 createSchema has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const createSchema = (state, setState, ems, initialValues, storageId, setStorageId, volumeId, setVolumeId) => {
  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 InterfacesForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const InterfacesForm = ({ interfaces, add, routerId }) => {
  const [{ initialValues, isLoading }, setState] = useState({ isLoading: !!routerId });

  const onSubmit = (values) => {
    if (add) {
Severity: Minor
Found in app/javascript/components/network-routers-interfaces-form/index.jsx - 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 EditPasswordField has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const EditPasswordField = ({ componentClass, ...props }) => {
  const {
    labelText, validateOnMount, isDisabled, editMode, setEditMode, buttonLabel, input, meta, ...rest
  } = useFieldApi(prepareProps(props));

Severity: Minor
Found in app/javascript/components/async-credentials/edit-password-field.jsx - 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 SearchBar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const SearchBar = ({ searchText, advancedSearch, action }) => {
  const formToken = () => {
    const csrfToken = document.querySelector('meta[name=csrf-token]');
    return csrfToken ? csrfToken.getAttribute('content') : '';
  };
Severity: Minor
Found in app/javascript/components/search-bar/index.jsx - 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 processOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function processOptions(options) {
  const o = Object.assign({}, options);

  delete o.body;
  delete o.data;
Severity: Minor
Found in app/javascript/http_api/fetch.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 getParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const getParams = (urlParms, sendChecked) => {
  const params = [];

  if (urlParms && (urlParms[0] === '?')) {
    params.push(urlParms.slice(1));
Severity: Minor
Found in app/javascript/components/miq-toolbar.jsx - 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