RedHatInsights/insights-rbac-ui

View on GitHub

Showing 109 of 381 total issues

File Messages.js has 2210 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { defineMessages } from 'react-intl';

export default defineMessages({
  inviteUsers: {
    id: 'inviteUsers',
Severity: Major
Found in src/Messages.js - About 6 days to fix

    Function User has 285 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const User = () => {
      const intl = useIntl();
      const navigate = useAppNavigate();
      const navigationType = useNavigationType();
      const dispatch = useDispatch();
    Severity: Major
    Found in src/smart-components/user/user.js - About 1 day to fix

      Function Permissions has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
      Open

      const Permissions = ({ cantAddPermissions, isLoading }) => {
        const intl = useIntl();
        const { role, isRecordLoading } = useSelector(
          (state) => ({
            role: state.roleReducer.selectedRole,
      Severity: Minor
      Found in src/smart-components/role/role-permissions.js - About 1 day 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 Group has 241 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Group = () => {
        const intl = useIntl();
        const dispatch = useDispatch();
        const navigate = useAppNavigate();
        const location = useLocation();
      Severity: Major
      Found in src/smart-components/group/group.js - About 1 day to fix

        Function Groups has 234 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Groups = () => {
          const intl = useIntl();
          const dispatch = useDispatch();
          const navigate = useNavigate();
          const location = useLocation();
        Severity: Major
        Found in src/smart-components/group/groups.js - About 1 day to fix

          Function WorkspacesOverview has 233 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const WorkspacesOverview = () => {
            const [isExpanded, setIsExpanded] = React.useState(false);
            const intl = useIntl();
            const navigate = useNavigate();
          
          
          Severity: Major
          Found in src/smart-components/workspaces/overview/about-access-tab.tsx - About 1 day to fix

            Function Roles has 232 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Roles = () => {
              const { orgAdmin, userAccessAdministrator } = useContext(PermissionsContext);
              const [selectedRows, setSelectedRows] = useState([]);
              const intl = useIntl();
              const dispatch = useDispatch();
            Severity: Major
            Found in src/smart-components/role/roles.js - About 1 day to fix

              Function Overview has 225 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Overview = () => {
                const intl = useIntl();
                const [expanded, setExpanded] = useState(true);
                const isWorkspacesFlag = useFlag('platform.rbac.workspaces');
                const isWorkspacesEligible = useFlag('platform.rbac.workspaces-eligible');
              Severity: Major
              Found in src/smart-components/overview/overview.js - About 1 day to fix

                File users-list-itless.js has 515 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React, { useEffect, Fragment, useState, useContext, useRef, useCallback, Suspense } from 'react';
                import { useSelector, useDispatch } from 'react-redux';
                import truncate from 'lodash/truncate';
                import { useIntl } from 'react-intl';
                import PropTypes from 'prop-types';
                Severity: Major
                Found in src/smart-components/group/add-group/users-list-itless.js - About 1 day to fix

                  Function Role has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const Role = ({ onDelete }) => {
                    const intl = useIntl();
                    const chrome = useChrome();
                    const navigate = useAppNavigate();
                    const navigationType = useNavigationType();
                  Severity: Minor
                  Found in src/smart-components/role/role.js - About 1 day 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 schemaBuilder has 206 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/schema.js - About 1 day to fix

                    Function InventoryGroupsRole has 205 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const InventoryGroupsRole = (props) => {
                      const intl = useIntl();
                      const dispatch = useDispatch();
                      const { input } = useFieldApi(props);
                      const formOptions = useFormApi();
                    Severity: Major
                    Found in src/smart-components/role/add-role/inventory-groups-role.js - About 1 day to fix

                      Function User has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const User = () => {
                        const intl = useIntl();
                        const navigate = useAppNavigate();
                        const navigationType = useNavigationType();
                        const dispatch = useDispatch();
                      Severity: Minor
                      Found in src/smart-components/user/user.js - About 7 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 GroupMembers has 179 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const GroupMembers = () => {
                        const intl = useIntl();
                        const chrome = useChrome();
                        const [filterValue, setFilterValue] = useState('');
                        const [selectedMembers, setSelectedMembers] = useState([]);
                      Severity: Major
                      Found in src/smart-components/group/member/group-members.js - About 7 hrs to fix

                        Function GroupServiceAccounts has 172 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const GroupServiceAccounts = () => {
                          const intl = useIntl();
                          const dispatch = useDispatch();
                          const navigate = useAppNavigate();
                          const { groupId } = useParams();
                        Severity: Major
                        Found in src/smart-components/group/service-account/group-service-accounts.js - About 6 hrs to fix

                          Function createRows has 170 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const createRows = (isAdmin, data, selectedRows, expanded = []) => {
                            const intl = useIntl();
                          
                            const compoundRolesCells = [
                              { title: intl.formatMessage(messages.roleName) },
                          Severity: Major
                          Found in src/smart-components/group/group-table-helpers.js - About 6 hrs to fix

                            Function UsersListItless has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const UsersListItless = ({ 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-itless.js - About 6 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 GroupRoles has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const GroupRoles = ({ onDefaultGroupChanged }) => {
                              const intl = useIntl();
                              const chrome = useChrome();
                              const dispatch = useDispatch();
                              const navigate = useAppNavigate();
                            Severity: Minor
                            Found in src/smart-components/group/role/group-roles.js - About 5 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 ResourceDefinitions has 139 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const ResourceDefinitions = () => {
                              const intl = useIntl();
                              const [config, setConfig] = useState({
                                pagination: {
                                  ...defaultSettings,
                            Severity: Major
                            Found in src/smart-components/role/role-resource-definitions.js - About 5 hrs to fix

                              Function AddPermissionsTable has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const AddPermissionsTable = ({ selectedPermissions, setSelectedPermissions, ...props }) => {
                                const [isOrgAdmin, setIsOrgAdmin] = useState(null);
                                const { auth } = useChrome();
                                const dispatch = useDispatch();
                                const intl = useIntl();
                              Severity: Minor
                              Found in src/smart-components/role/add-role/add-permissions.js - About 5 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