Showing 109 of 381 total issues
File add-permissions.js
has 368 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useCallback, useState, useEffect, useMemo } from 'react';
import PropTypes from 'prop-types';
import { shallowEqual, useSelector, useDispatch } from 'react-redux';
import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome';
import useFieldApi from '@data-driven-forms/react-form-renderer/use-field-api';
Function InventoryGroupsRole
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
const InventoryGroupsRole = (props) => {
const intl = useIntl();
const dispatch = useDispatch();
const { input } = useFieldApi(props);
const formOptions = useFormApi();
- Read upRead up
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
File toolbar.js
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import PrimaryToolbar from '@redhat-cloud-services/frontend-components/PrimaryToolbar';
import { useIntl } from 'react-intl';
import PropTypes from 'prop-types';
import messages from '../../Messages';
Function CostResources
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CostResources = (props) => {
const intl = useIntl();
const dispatch = useDispatch();
const fetchData = (apiProps) => dispatch(fetchResourceDefinitions(apiProps));
const getResource = (apiProps) => dispatch(fetchResource(apiProps));
File group-roles.js
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useState, useEffect, Fragment, useContext, useRef, Suspense } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { FormattedMessage, useIntl } from 'react-intl';
import PropTypes from 'prop-types';
import { Outlet, useParams } from 'react-router-dom';
Function Group
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
const Group = () => {
const intl = useIntl();
const dispatch = useDispatch();
const navigate = useAppNavigate();
const location = useLocation();
- Read upRead up
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 EnableWorkspacesAlert
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
const EnableWorkspacesAlert: React.FunctionComponent = () => {
const [checked, setChecked] = React.useState<boolean>(false);
const [isModalOpen, setIsModalOpen] = React.useState<boolean>(false);
const [isConfirmed, setIsConfirmed] = React.useState<boolean>(false);
const intl = useIntl();
File inventory-groups-role.js
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useReducer } from 'react';
import {
Button,
Grid,
GridItem,
Function schemaBuilder
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const schemaBuilder = (container, enableServiceAccounts) => {
const cache = createIntlCache();
const intl = createIntl({ locale, messages: providerMessages }, cache);
return {
fields: [
Function ReviewStep
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ReviewStep = () => {
const intl = useIntl();
const enableWorkspacesNameChange = useFlag('platform.rbac.groups-to-workspaces-rename');
const formOptions = useFormApi();
const {
File user.js
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useState, useContext, Fragment, Suspense } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { Outlet, useNavigationType, useParams } from 'react-router-dom';
import { useIntl } from 'react-intl';
import { Button, Label, Stack, StackItem, Text, TextContent, TextVariants } from '@patternfly/react-core';
Function TableToolbarView
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export const TableToolbarView = ({
className,
isCompact,
borders,
columns,
- Read upRead up
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
File role-permissions.js
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useReducer, useState } from 'react';
import PropTypes from 'prop-types';
import { cellWidth, info } from '@patternfly/react-table';
import { Button, ButtonVariant } from '@patternfly/react-core';
import { FormattedMessage, useIntl } from 'react-intl';
Function SummaryContent
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SummaryContent = () => {
const intl = useIntl();
const formOptions = useFormApi();
const { isBeta } = useChrome();
const {
Function schemaBuilder
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const schemaBuilder = (container, featureFlag) => {
const cache = createIntlCache();
const intl = createIntl({ locale, messages: providerMessages }, cache);
return {
Function BaseRoleTable
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
const BaseRoleTable = (props) => {
const intl = useIntl();
const dispatch = useDispatch();
const fetchData = (options) => dispatch(fetchRolesForWizard(options));
const [filterValue, setFilterValue] = useState('');
Function reducer
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
const reducer = (state, action) => {
const prevState = state[action.key];
switch (action.type) {
case 'toggle':
return {
File table-composable-toolbar-view.tsx
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Fragment } from 'react';
import { useIntl } from 'react-intl';
import messages from '../../Messages';
import { TableVariant, Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
import TableToolbar from '@redhat-cloud-services/frontend-components/TableToolbar';
Function makeRow
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
const makeRow = (permissionID, index) => {
const options = Object.values(resourceTypes?.[permissionID] ?? {});
return (
<React.Fragment key={permissionID}>
Function activeFiltersConfigBuilder
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export const activeFiltersConfigBuilder = (
filterValue = '',
filters,
pagination = {},
setFilterValue = () => undefined,
- Read upRead up
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"