RedHatInsights/insights-rbac-ui

View on GitHub

Showing 381 of 381 total issues

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

            <Tr>
              <Td>Structuring your workspaces to fit your organizational use cases</Td>
              <Td>
                <Label color="orange">Documentation</Label>
              </Td>
src/smart-components/workspaces/overview/about-access-tab.tsx on lines 253..264
src/smart-components/workspaces/overview/about-access-tab.tsx on lines 265..276

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 106.

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 3 locations. Consider refactoring.
Open

            <Tr>
              <Td>Understanding access management</Td>
              <Td>
                <Label color="orange">Documentation</Label>
              </Td>
src/smart-components/workspaces/overview/about-access-tab.tsx on lines 241..252
src/smart-components/workspaces/overview/about-access-tab.tsx on lines 253..264

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 106.

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 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';
Severity: Minor
Found in src/smart-components/role/role-permissions.js - About 3 hrs to fix

    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 {
    Severity: Major
    Found in src/smart-components/group/add-group/summary-content.js - About 3 hrs to fix

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

      export const fetchSystemGroup = ({ filterValue, chrome } = {}) => ({
        type: ActionTypes.FETCH_SYSTEM_GROUP,
        payload: GroupHelper.fetchGroups({
          limit: 1,
          ...(filterValue?.length > 0 ? { filters: { name: filterValue }, nameMatch: 'partial' } : {}),
      Severity: Major
      Found in src/redux/actions/group-actions.js and 1 other location - About 3 hrs to fix
      src/redux/actions/group-actions.js on lines 23..31

      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 104.

      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

      export const fetchAdminGroup = ({ filterValue, chrome } = {}) => ({
        type: ActionTypes.FETCH_ADMIN_GROUP,
        payload: GroupHelper.fetchGroups({
          limit: 1,
          ...(filterValue?.length > 0 ? { filters: { name: filterValue }, nameMatch: 'partial' } : {}),
      Severity: Major
      Found in src/redux/actions/group-actions.js and 1 other location - About 3 hrs to fix
      src/redux/actions/group-actions.js on lines 33..41

      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 104.

      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

      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 {
      Severity: Major
      Found in src/smart-components/role/add-role-permissions/schema.js - About 3 hrs to fix

        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('');
        Severity: Major
        Found in src/smart-components/role/add-role/base-role-table.js - About 3 hrs to fix

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

                    {
                      label: intl.formatMessage(messages.delete),
                      props: {
                        isDisabled: !selectedRows.length > 0,
                      },
          Severity: Major
          Found in src/smart-components/role/roles.js and 1 other location - About 3 hrs to fix
          src/smart-components/group/groups.js on lines 167..183

          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 103.

          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

                    {
                      label: intl.formatMessage(messages.delete),
                      props: {
                        isDisabled: !selectedRows.length > 0,
                      },
          Severity: Major
          Found in src/smart-components/group/groups.js and 1 other location - About 3 hrs to fix
          src/smart-components/role/roles.js on lines 151..167

          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 103.

          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

                onSort={(e, index, direction) => {
                  const orderBy = `${direction === 'desc' ? '-' : ''}${columns[index - 1].key}`;
                  setSortByState({ index, direction });
                  fetchData({ ...pagination, filters, usesMetaInURL, orderBy });
                }}
          Severity: Major
          Found in src/smart-components/group/add-group/users-list.js and 1 other location - About 3 hrs to fix
          src/smart-components/group/add-group/users-list-itless.js on lines 459..463

          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 101.

          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

                  onSort={(e, index, direction) => {
                    const orderBy = `${direction === 'desc' ? '-' : ''}${columns[index - 1].key}`;
                    setSortByState({ index, direction });
                    fetchData({ ...pagination, filters, usesMetaInURL, orderBy });
                  }}
          Severity: Major
          Found in src/smart-components/group/add-group/users-list-itless.js and 1 other location - About 3 hrs to fix
          src/smart-components/group/add-group/users-list.js on lines 115..119

          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 101.

          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

          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 {
          Severity: Major
          Found in src/smart-components/role/add-role/inventory-groups-role.js - About 3 hrs to fix

            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';

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

                  } else {
                    setSelectedRows((users) => {
                      return newSelection(users)
                        .filter((user) => (displayNarrow ? user : user?.uuid != currentUser?.identity?.internal?.account_id))
                        .map(({ uuid, username }) => ({ uuid, label: username || uuid }));
              Severity: Major
              Found in src/smart-components/group/add-group/users-list-itless.js and 1 other location - About 3 hrs to fix
              src/smart-components/group/add-group/users-list-itless.js on lines 374..380

              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 99.

              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

                Object.keys(params).forEach((key) => {
                  const value = params[key];
              
                  if (Array.isArray(value)) {
                    value.forEach((item) => item && searchParams.append(key, item));
              Severity: Major
              Found in src/helpers/shared/helpers.js and 1 other location - About 3 hrs to fix
              src/helpers/shared/filters.js on lines 49..57

              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 99.

              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

                Object.keys(newValues).forEach((key) => {
                  const value = newValues[key];
              
                  if (Array.isArray(value)) {
                    value.forEach((item) => item && searchParams.append(key, item));
              Severity: Major
              Found in src/helpers/shared/filters.js and 1 other location - About 3 hrs to fix
              src/helpers/shared/helpers.js on lines 45..53

              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 99.

              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

                  if (setSelectedUsers) {
                    setSelectedUsers((users) => {
                      return newSelection(users)
                        .filter((user) => (displayNarrow ? user : user?.uuid != currentUser?.identity?.internal?.account_id))
                        .map(({ uuid, username }) => ({ uuid, label: username || uuid }));
              Severity: Major
              Found in src/smart-components/group/add-group/users-list-itless.js and 1 other location - About 3 hrs to fix
              src/smart-components/group/add-group/users-list-itless.js on lines 380..386

              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 99.

              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

              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}>
              Severity: Major
              Found in src/smart-components/role/add-role/inventory-groups-role.js - About 3 hrs to fix

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

                export const fetchRoles = (options = {}) => ({
                  type: ActionTypes.FETCH_ROLES,
                  payload: RoleHelper.fetchRoles(options).catch((err) => {
                    const error = err?.errors?.[0] || {};
                    if (error.status === '400' && error.source === 'detail') {
                Severity: Major
                Found in src/redux/actions/role-actions.js and 1 other location - About 3 hrs to fix
                src/redux/actions/role-actions.js on lines 28..38

                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 98.

                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