Katello/katello

View on GitHub
webpack/scenes/AlternateContentSources/MainTable/ACSTable.js

Summary

Maintainability
F
5 days
Test Coverage

Function ACSTable has 397 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ACSTable = () => {
  const response = useSelector(selectAlternateContentSources);
  const status = useSelector(selectAlternateContentSourcesStatus);
  const error = useSelector(selectAlternateContentSourcesError);
  const resolved = status === STATUS.RESOLVED;
Severity: Major
Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js - About 1 day to fix

    File ACSTable.js has 445 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useCallback, useEffect, useRef, useState } from 'react';
    import { useHistory, useLocation } from 'react-router-dom';
    import { useDispatch, useSelector } from 'react-redux';
    import { capitalize, upperCase, omit } from 'lodash';
    import { translate as __ } from 'foremanReact/common/I18n';
    Severity: Minor
    Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js - About 6 hrs to fix

      Function ACSTable has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

      const ACSTable = () => {
        const response = useSelector(selectAlternateContentSources);
        const status = useSelector(selectAlternateContentSourcesStatus);
        const error = useSelector(selectAlternateContentSourcesError);
        const resolved = status === STATUS.RESOLVED;
      Severity: Minor
      Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js - About 3 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 PanelContent has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const PanelContent = () => {
          if (!resolved) return <></>;
          const acs = results?.find(source => source?.id === Number(expandedId));
          if (!acs && isExpanded) {
            setExpandedId(null);
      Severity: Major
      Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js - About 3 hrs to fix

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

                              <DropdownItem
                                aria-label="bulk_refresh"
                                ouiaId="bulk_refresh"
                                key="bulk_refresh"
                                isDisabled={selectedCount < 1 || !canEdit}
        Severity: Major
        Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js and 1 other location - About 2 hrs to fix
        webpack/scenes/AlternateContentSources/MainTable/ACSTable.js on lines 365..377

        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

                              <DropdownItem
                                aria-label="bulk_delete"
                                ouiaId="bulk_delete"
                                key="bulk_delete"
                                isDisabled={selectedCount < 1 || !canDelete}
        Severity: Major
        Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js and 1 other location - About 2 hrs to fix
        webpack/scenes/AlternateContentSources/MainTable/ACSTable.js on lines 352..364

        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

                                <Checkbox
                                  ouiaId={`select-acs-${id}`}
                                  id={id}
                                  aria-label={`Select ACS ${id}`}
                                  isChecked={isSelected(id)}
        webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js on lines 149..155

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

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

                      {...{
                        metadata,
                        emptyContentTitle,
                        emptyContentBody,
                        emptySearchTitle,
        webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesTab.js on lines 204..219
        webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js on lines 244..258
        webpack/scenes/ContentViews/Details/Filters/AffectedRepositories/AffectedRepositoryTable.js on lines 204..218
        webpack/scenes/ContentViews/Details/Filters/CVErrataIDFilterContent.js on lines 261..275

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

        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

                          {columnHeaders.map(col => (
                            <Th
                              key={col}
                              sort={COLUMNS_TO_SORT_PARAMS[col] ? pfSortParams(col) : undefined}
                            >
        webpack/scenes/ContentViews/Table/ContentViewsTable.js on lines 225..232

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

        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

          const {
            selectOne, isSelected, isSelectable: _isSelectable,
            selectedCount, selectionSet, ...selectionSetVars
          } = useSelectionSet({
            results,
        Severity: Minor
        Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js and 1 other location - About 50 mins to fix
        webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js on lines 72..78

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

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

          const {
            pfSortParams, apiSortParams,
            activeSortColumn, activeSortDirection,
          } = useTableSort({
            allColumns: columnHeaders,
        Severity: Major
        Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js and 6 other locations - About 40 mins to fix
        webpack/components/extensions/HostDetails/Tabs/DebsTab/DebsTab.js on lines 175..182
        webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js on lines 171..178
        webpack/components/extensions/HostDetails/Tabs/ModuleStreamsTab/ModuleStreamsTab.js on lines 256..263
        webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js on lines 182..189
        webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesTab.js on lines 66..73
        webpack/scenes/ContentViews/Table/ContentViewsTable.js on lines 60..67

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

        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

          const primaryActionButton = (
            <Button
              ouiaId="create-acs"
              onClick={createButtonOnclick}
              variant="primary"
        Severity: Minor
        Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js and 1 other location - About 40 mins to fix
        webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsCard.js on lines 75..83

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

        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

            const refreshAction = {
              title: __('Refresh'),
              ouiaId: `refresh-acs-${id}`,
              onClick: () => {
                onRefresh(id);
        Severity: Minor
        Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js and 1 other location - About 40 mins to fix
        webpack/scenes/AlternateContentSources/MainTable/ACSTable.js on lines 267..273

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

        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

            const deleteAction = {
              title: __('Delete'),
              ouiaId: `remove-acs-${id}`,
              onClick: () => {
                onDelete(id);
        Severity: Minor
        Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js and 1 other location - About 40 mins to fix
        webpack/scenes/AlternateContentSources/MainTable/ACSTable.js on lines 274..280

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

        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

        There are no issues that match your filters.

        Category
        Status