RedHatInsights/insights-rbac-ui

View on GitHub

Showing 109 of 381 total issues

Function createITLessRows has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const createITLessRows = (userLinks, data, checkedRows = []) => {
    const maxLength = 25;
    return data
      ? data.reduce(
          (
Severity: Major
Found in src/smart-components/group/add-group/users-list-itless.js - About 3 hrs to fix

    Function renderTable has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const renderTable = () => {
        const orderBy = `${sortBy?.direction === 'desc' ? '-' : ''}${columns[sortBy?.index]?.key}`;
        return (
          <Fragment>
            <Toolbar
    Severity: Major
    Found in src/presentational-components/shared/table-toolbar-view.js - About 2 hrs to fix

      Function ReviewTemplate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      const ReviewTemplate = ({ formFields }) => {
        const intl = useIntl();
        const navigate = useAppNavigate();
        const { submittingGroup, submittingServiceAccounts, error, setWizardError } = useContext(AddGroupWizardContext);
        const { getState } = useFormApi();
      Severity: Minor
      Found in src/smart-components/group/add-group/review-template.js - About 2 hrs 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

      File group-actions.js has 287 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as ActionTypes from '../action-types';
      import * as GroupHelper from '../../helpers/group/group-helper';
      import { createIntl, createIntlCache } from 'react-intl';
      import { BAD_UUID } from '../../helpers/shared/helpers';
      import messages from '../../Messages';
      Severity: Minor
      Found in src/redux/actions/group-actions.js - About 2 hrs to fix

        Function SetName has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const SetName = (props) => {
          const intl = useIntl();
          const { input } = useFieldApi(props);
          const formOptions = useFormApi();
          const { 'role-name': name, 'role-description': description } = formOptions.getState().values;
        Severity: Major
        Found in src/smart-components/role/add-role/set-name.js - About 2 hrs to fix

          Function SetName has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const SetName = (props) => {
            const intl = useIntl();
            const { input } = useFieldApi(props);
            const formOptions = useFormApi();
            const { 'group-name': name, 'group-description': description } = formOptions.getState().values;
          Severity: Major
          Found in src/smart-components/group/add-group/set-name.js - About 2 hrs to fix

            File Routing.tsx has 282 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { Navigate, Route as RouterRoute, Routes as RouterRoutes, matchPath, useLocation } from 'react-router-dom';
            import React, { lazy, Suspense, useEffect, useMemo } from 'react';
            import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome';
            import { AppPlaceholder } from './presentational-components/shared/loader-placeholders';
            import pathnames from './utilities/pathnames';
            Severity: Minor
            Found in src/Routing.tsx - About 2 hrs to fix

              Function UsersAndUserGroups has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const UsersAndUserGroups: React.FunctionComponent = () => {
                const intl = useIntl();
                const [activeTabKey, setActiveTabKey] = React.useState<number>(0);
                const [isAddUserGroupModalOpen, setIsAddUserGroupModalOpen] = React.useState<boolean>(false);
                const [selectedUsers, setSelectedUsers] = React.useState<any[]>([]);
              Severity: Major
              Found in src/smart-components/access-management/users-and-user-groups.tsx - About 2 hrs to fix

                Function MyUserAccess has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const MyUserAccess = () => {
                  const intl = useIntl();
                  const chrome = useChrome();
                  const [user, setUser] = useState({});
                  const [{ bundle }, setSearchParams] = useSearchParams();
                Severity: Major
                Found in src/smart-components/myUserAccess/MUAHome.js - About 2 hrs to fix

                  Function Workspaces has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const Workspaces = () => {
                    const intl = useIntl();
                    const dispatch = useDispatch();
                    const selection = useDataViewSelection({ matchOption: (a, b) => a.id === b.id });
                  
                  
                  Severity: Major
                  Found in src/smart-components/workspaces/workspaces.tsx - About 2 hrs to fix

                    Function AddRolePermissionSummaryContent has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const AddRolePermissionSummaryContent = () => {
                      const intl = useIntl();
                      const formOptions = useFormApi();
                      const {
                        'role-name': name,

                      Function Groups has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const Groups = () => {
                        const intl = useIntl();
                        const dispatch = useDispatch();
                        const navigate = useNavigate();
                        const location = useLocation();
                      Severity: Minor
                      Found in src/smart-components/group/groups.js - About 2 hrs 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

                      File groups.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React, { Suspense, useContext, useEffect, useRef, useCallback, useState } from 'react';
                      import { Outlet, useLocation, useNavigate } from 'react-router-dom';
                      import { nowrap, sortable, compoundExpand } from '@patternfly/react-table';
                      import { Button, Stack, StackItem } from '@patternfly/react-core';
                      import { useIntl } from 'react-intl';
                      Severity: Minor
                      Found in src/smart-components/group/groups.js - About 2 hrs to fix

                        File about-access-tab.tsx has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React from 'react';
                        import { ContentHeader, ServiceCard } from '@patternfly/react-component-groups';
                        import {
                          Button,
                          ButtonVariant,
                        Severity: Minor
                        Found in src/smart-components/workspaces/overview/about-access-tab.tsx - About 2 hrs to fix

                          Function MainTable has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const MainTable = ({
                            // props for toolbar
                            columns,
                            isSelectable,
                            isLoading,

                          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 group.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React, { Fragment, useEffect, useState } from 'react';
                          import useChrome from '@redhat-cloud-services/frontend-components/useChrome';
                          import { useLocation, useParams, Outlet, useNavigationType } from 'react-router-dom';
                          import { shallowEqual, useDispatch, useSelector } from 'react-redux';
                          import { FormattedMessage, useIntl } from 'react-intl';
                          Severity: Minor
                          Found in src/smart-components/group/group.js - About 2 hrs to fix

                            File overview.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React, { useState } from 'react';
                            import {
                              ActionList,
                              ActionListItem,
                              Button,
                            Severity: Minor
                            Found in src/smart-components/overview/overview.js - About 2 hrs to fix

                              File roles.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React, { useState, useEffect, useContext, useRef, Suspense } from 'react';
                              import { useIntl } from 'react-intl';
                              import { shallowEqual, useSelector, useDispatch } from 'react-redux';
                              import { Outlet, useLocation, useNavigate } from 'react-router-dom';
                              import { cellWidth, compoundExpand, nowrap, sortable } from '@patternfly/react-table';
                              Severity: Minor
                              Found in src/smart-components/role/roles.js - About 2 hrs to fix

                                Function EditResourceDefinitionsModal has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const EditResourceDefinitionsModal = ({ cancelRoute }) => {
                                  const intl = useIntl();
                                  const { roleId, permissionId } = useParams();
                                  const navigate = useAppNavigate();
                                
                                
                                Severity: Minor
                                Found in src/smart-components/role/edit-resource-definitions-modal.js - About 2 hrs 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 UsersList has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const UsersList = ({ selectedUsers, setSelectedUsers, userLinks, usesMetaInURL, displayNarrow, props }) => {
                                  const intl = useIntl();
                                  const navigate = useNavigate();
                                  const location = useLocation();
                                  const dispatch = useDispatch();
                                Severity: Minor
                                Found in src/smart-components/group/add-group/users-list.js - About 2 hrs 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