RedHatInsights/insights-rbac-ui

View on GitHub

Showing 381 of 381 total issues

Function toolbarDropdowns has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const toolbarDropdowns = () => {
    const onToggle = (isOpen) => {
      setIsToolbarDropdownOpen(isOpen);
    };
    const onToolbarDropdownSelect = async (_event) => {
Severity: Minor
Found in src/smart-components/group/add-group/users-list-itless.js - About 1 hr to fix

    Function Routing has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Routing = () => {
      const location = useLocation();
      const { updateDocumentTitle, isBeta } = useChrome();
      const isITLess = useFlag('platform.rbac.itless');
      const enableServiceAccounts =
    Severity: Minor
    Found in src/Routing.tsx - About 1 hr to fix

      Function TypeSelector has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const TypeSelector = (props) => {
        const intl = useIntl();
        const { input } = useFieldApi(props);
        const formOptions = useFormApi();
        const [checked, setChecked] = useState(formOptions.getState().values['role-type']);
      Severity: Minor
      Found in src/smart-components/role/add-role/type-selector.js - About 1 hr to fix

        Function AddRoleWizard has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        const AddRoleWizard = ({ pagination, filters, orderBy }) => {
          const intl = useIntl();
          const dispatch = useDispatch();
          const navigate = useAppNavigate();
          const chrome = useChrome();
        Severity: Minor
        Found in src/smart-components/role/add-role/add-role-wizard.js - About 1 hr 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 3 locations. Consider refactoring.
        Open

        export default {
          [`${FETCH_INVENTORY_GROUPS}_PENDING`]: setLoadingState,
          [`${FETCH_INVENTORY_GROUPS}_FULFILLED`]: setResourceTypes,
          [`${FETCH_INVENTORY_GROUPS_DETAILS}_PENDING`]: setLoadingState,
          [`${FETCH_INVENTORY_GROUPS_DETAILS}_FULFILLED`]: setInventoryGroupsDetails,
        Severity: Major
        Found in src/redux/reducers/inventory-reducer.js and 2 other locations - About 1 hr to fix
        src/redux/reducers/cost-reducer.js on lines 26..31
        src/redux/reducers/policy-reducer.js on lines 23..28

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

        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

        export default {
          [`${FETCH_GROUP_POLICIES}_PENDING`]: setLoadingState,
          [`${FETCH_GROUP_POLICIES}_FULFILLED`]: setPolicies,
          [`${FETCH_POLICY}_PENDING`]: setRecordLoadingState,
          [`${FETCH_POLICY}_FULFILLED`]: selectPolicy,
        Severity: Major
        Found in src/redux/reducers/policy-reducer.js and 2 other locations - About 1 hr to fix
        src/redux/reducers/cost-reducer.js on lines 26..31
        src/redux/reducers/inventory-reducer.js on lines 36..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 60.

        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 CommonBundleView has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        const CommonBundleView = ({ apps }) => {
          const isOrgAdmin = useContext(OrgAdminContext);
          const [name, setName] = useState('');
          const [permission, setPermission] = useState('');
          const [application, setApplication] = useState([]);
        Severity: Minor
        Found in src/smart-components/myUserAccess/CommonBundleView.js - About 1 hr 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 3 locations. Consider refactoring.
        Open

        export default {
          [`${FETCH_RESOURCE_DEFINITIONS}_PENDING`]: setLoadingState,
          [`${FETCH_RESOURCE_DEFINITIONS}_FULFILLED`]: setResourceDefinitions,
          [`${FETCH_RESOURCE}_PENDING`]: setResourceLoading,
          [`${FETCH_RESOURCE}_FULFILLED`]: setResource,
        Severity: Major
        Found in src/redux/reducers/cost-reducer.js and 2 other locations - About 1 hr to fix
        src/redux/reducers/inventory-reducer.js on lines 36..41
        src/redux/reducers/policy-reducer.js on lines 23..28

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

        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 rows has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const rows = useMemo(() => {
            return users.map((user: UserProps) => ({
              id: user.username,
              is_active: user.is_active,
              row: [
        Severity: Minor
        Found in src/smart-components/access-management/UsersTable.tsx - About 1 hr to fix

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

                title={
                  submittingGroup
                    ? intl.formatMessage(messages.groupNameTakenTitle)
                    : intl.formatMessage(messages.addGroupServiceAccountsErrorTitle, { count: getState().values['service-accounts-list'].length })
                }
          Severity: Major
          Found in src/smart-components/group/add-group/review-template.js and 1 other location - About 1 hr to fix
          src/smart-components/group/add-group/review-template.js on lines 76..80

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

          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 Users has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const Users = () => {
            const intl = useIntl();
            const activeUserPermissions = useContext(PermissionsContext);
            const { appNavClick } = useChrome();
            const isITLess = useFlag('platform.rbac.itless');
          Severity: Minor
          Found in src/smart-components/user/users.tsx - About 1 hr to fix

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

                  text={
                    submittingGroup
                      ? intl.formatMessage(messages.groupNameTakenText)
                      : intl.formatMessage(messages.addNewGroupServiceAccountsErrorDescription, { count: getState().values['service-accounts-list'].length })
                  }
            Severity: Major
            Found in src/smart-components/group/add-group/review-template.js and 1 other location - About 1 hr to fix
            src/smart-components/group/add-group/review-template.js on lines 71..75

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

            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 addUsers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const addUsers = (usersData) => {
              const cache = createIntlCache();
              const intl = createIntl({ locale, messages: providerMessages }, cache);
              return {
                type: ActionTypes.ADD_USERS,
            Severity: Minor
            Found in src/redux/actions/user-actions.js - About 1 hr to fix

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

                            attributeFilter = {
                              key: 'group.id',
                              operation: 'in',
                              value: invResources?.find((g) => g.permission === permission)?.groups?.map((group) => group?.id),
                            };
              Severity: Major
              Found in src/smart-components/role/add-role/add-role-wizard.js and 1 other location - About 1 hr to fix
              src/smart-components/role/add-role-permissions/add-role-permission-wizard.js on lines 92..96

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

              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

              const AddGroupRoles = ({
                afterSubmit,
                fetchUuid,
                selectedRoles,
                setSelectedRoles,
              Severity: Major
              Found in src/smart-components/group/role/add-group-roles.js and 2 other locations - About 1 hr to fix
              src/smart-components/group/group-table-helpers.js on lines 68..80
              src/smart-components/group/role/group-roles.js on lines 111..123

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

              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

                const {
                  roles,
                  pagination,
                  groupsPagination,
                  groupsFilters,
              Severity: Major
              Found in src/smart-components/group/role/group-roles.js and 2 other locations - About 1 hr to fix
              src/smart-components/group/group-table-helpers.js on lines 68..80
              src/smart-components/group/role/add-group-roles.js on lines 17..29

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

              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

                                      attributeFilter: {
                                        key: 'group.id',
                                        operation: 'in',
                                        value: invResources?.find((g) => g.permission === permission)?.groups?.map((group) => group?.id),
                                      },
              src/smart-components/role/add-role/add-role-wizard.js on lines 133..137

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

              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

                    {
                      uuid,
                      name,
                      roleCount,
                      principalCount,
              Severity: Major
              Found in src/smart-components/group/group-table-helpers.js and 2 other locations - About 1 hr to fix
              src/smart-components/group/role/add-group-roles.js on lines 17..29
              src/smart-components/group/role/group-roles.js on lines 111..123

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

              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

                useEffect(() => {
                  fetchData({
                    limit: perPage,
                    offset: (page - 1) * perPage,
                    orderBy: 'display_name',
              Severity: Major
              Found in src/smart-components/role/RolesTable.tsx and 2 other locations - About 1 hr to fix
              src/smart-components/access-management/UserGroupsTable.tsx on lines 88..95
              src/smart-components/access-management/UsersTable.tsx on lines 67..74

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

              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

                useEffect(() => {
                  fetchData({
                    limit: perPage,
                    offset: (page - 1) * perPage,
                    orderBy: 'username',
              Severity: Major
              Found in src/smart-components/access-management/UsersTable.tsx and 2 other locations - About 1 hr to fix
              src/smart-components/access-management/UserGroupsTable.tsx on lines 88..95
              src/smart-components/role/RolesTable.tsx on lines 77..84

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

              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