RedHatInsights/insights-rbac-ui

View on GitHub

Showing 381 of 381 total issues

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

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

            {
              path: pathnames['group-detail-members'].path,
              element: GroupMembers,
              childRoutes: [
                {
      Severity: Major
      Found in src/Routing.tsx and 3 other locations - About 2 hrs to fix
      src/Routing.tsx on lines 83..100
      src/Routing.tsx on lines 157..174
      src/Routing.tsx on lines 195..212

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 86.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

        {
          path: pathnames['role-detail'].path,
          element: Role,
          childRoutes: [
            {
      Severity: Major
      Found in src/Routing.tsx and 3 other locations - About 2 hrs to fix
      src/Routing.tsx on lines 157..174
      src/Routing.tsx on lines 175..192
      src/Routing.tsx on lines 195..212

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 86.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

                  {
                    path: pathnames['group-detail-service-accounts'].path,
                    element: GroupServiceAccounts,
                    childRoutes: [
                      {
      Severity: Major
      Found in src/Routing.tsx and 3 other locations - About 2 hrs to fix
      src/Routing.tsx on lines 83..100
      src/Routing.tsx on lines 157..174
      src/Routing.tsx on lines 175..192

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 86.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

            {
              path: pathnames['group-detail-roles'].path,
              element: GroupRoles,
              childRoutes: [
                {
      Severity: Major
      Found in src/Routing.tsx and 3 other locations - About 2 hrs to fix
      src/Routing.tsx on lines 83..100
      src/Routing.tsx on lines 175..192
      src/Routing.tsx on lines 195..212

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 86.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        RemoveRoles.propTypes = {
          text: PropTypes.node,
          title: PropTypes.node,
          confirmButtonLabel: PropTypes.string,
          onSubmit: PropTypes.func,
        Severity: Major
        Found in src/smart-components/group/role/remove-role-modal.js and 1 other location - About 2 hrs to fix
        src/smart-components/group/add-group/users-list-itless.js on lines 530..539

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 84.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        UsersListItless.propTypes = {
          displayNarrow: PropTypes.bool,
          users: PropTypes.array,
          searchFilter: PropTypes.string,
          setSelectedUsers: PropTypes.func,
        Severity: Major
        Found in src/smart-components/group/add-group/users-list-itless.js and 1 other location - About 2 hrs to fix
        src/smart-components/group/role/remove-role-modal.js on lines 36..45

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 84.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                            adminGroup.uuid === group.uuid ? null : (
                                              <AppLink
                                                to={pathnames['user-add-group-roles'].link.replace(':username', username).replace(':groupId', group.uuid)}
                                                state={{ name: group.name }}
                                              >
            Severity: Major
            Found in src/smart-components/user/user.js and 1 other location - About 2 hrs to fix
            src/smart-components/role/role-table-helpers.js on lines 54..61

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 83.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                      adminGroup?.uuid === group.uuid ? null : (
                                        <AppLink
                                          to={pathnames['roles-add-group-roles'].link.replace(':roleId', uuid).replace(':groupId', group.uuid)}
                                          state={{ name: group.name }}
                                        >
            Severity: Major
            Found in src/smart-components/role/role-table-helpers.js and 1 other location - About 2 hrs to fix
            src/smart-components/user/user.js on lines 139..146

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 83.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    meta: {
                      notifications: {
                        rejected: (payload) => ({
                          variant: 'danger',
                          title: intl.formatMessage(messages.editRoleErrorTitle),
                Severity: Major
                Found in src/redux/actions/role-actions.js and 1 other location - About 2 hrs to fix
                src/redux/actions/role-actions.js on lines 15..24

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 82.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    meta: {
                      notifications: {
                        rejected: (payload) => ({
                          variant: 'danger',
                          title: intl.formatMessage(messages.createRoleErrorTitle),
                Severity: Major
                Found in src/redux/actions/role-actions.js and 1 other location - About 2 hrs to fix
                src/redux/actions/role-actions.js on lines 103..112

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 82.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                              {
                                component: 'inventory-groups-role',
                                name: 'inventory-groups-role',
                                validate: [
                                  (value = []) =>
                Severity: Major
                Found in src/smart-components/role/add-role-permissions/schema.js and 1 other location - About 2 hrs to fix
                src/smart-components/role/add-role/schema.js on lines 176..185

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 81.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language