Katello/katello

View on GitHub
webpack/scenes/ContentViews/Table/ContentViewsTable.js

Summary

Maintainability
D
3 days
Test Coverage

Function ContentViewTable has 272 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ContentViewTable = () => {
  const response = useSelector(selectContentViews);
  const status = useSelector(selectContentViewStatus);
  const error = useSelector(selectContentViewError);
  const [searchQuery, updateSearchQuery] = useState('');
Severity: Major
Found in webpack/scenes/ContentViews/Table/ContentViewsTable.js - About 1 day to fix

    File ContentViewsTable.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useState, useCallback } from 'react';
    import { useSelector, useDispatch } from 'react-redux';
    import { Link } from 'react-router-dom';
    import { omit } from 'lodash';
    import { translate as __ } from 'foremanReact/common/I18n';
    Severity: Minor
    Found in webpack/scenes/ContentViews/Table/ContentViewsTable.js - About 3 hrs to fix

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

      const ContentViewTable = () => {
        const response = useSelector(selectContentViews);
        const status = useSelector(selectContentViewStatus);
        const error = useSelector(selectContentViewError);
        const [searchQuery, updateSearchQuery] = useState('');
      Severity: Minor
      Found in webpack/scenes/ContentViews/Table/ContentViewsTable.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

      Function actionsWithPermissions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const actionsWithPermissions = (cvInfo) => {
          const { version_count: cvVersionCount, generated_for: generatedFor, permissions } = cvInfo;
      
          const publishAction = {
            title: __('Publish'),
      Severity: Minor
      Found in webpack/scenes/ContentViews/Table/ContentViewsTable.js - About 1 hr to fix

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

                  const {
                    composite,
                    name,
                    id: cvId,
                    last_published: lastPublished,
        Severity: Major
        Found in webpack/scenes/ContentViews/Table/ContentViewsTable.js and 1 other location - About 1 hr to fix
        webpack/scenes/Subscriptions/SubscriptionsPage.js on lines 135..140

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

                        <Td>{latestVersion ?
                          <ContentViewVersionCell {...{
                            id: cvId,
                            latestVersion,
                            latestVersionId: cvLatestVersionId,
        Severity: Major
        Found in webpack/scenes/ContentViews/Table/ContentViewsTable.js and 1 other location - About 1 hr to fix
        webpack/scenes/ContentViews/Table/tableDataGenerator.js on lines 38..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 72.

        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

                  {
                    isDeleteModalOpen &&
                    <ContentViewDeleteWizard
                      cvId={id && Number(id)}
                      cvEnvironments={environments}
        Severity: Major
        Found in webpack/scenes/ContentViews/Table/ContentViewsTable.js and 1 other location - About 1 hr to fix
        webpack/scenes/ContentViews/Details/ContentViewDetails.js on lines 236..246

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

        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}
                    >
        Severity: Major
        Found in webpack/scenes/ContentViews/Table/ContentViewsTable.js and 1 other location - About 1 hr to fix
        webpack/scenes/AlternateContentSources/MainTable/ACSTable.js on lines 397..404

        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

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

                            <DetailsExpansion
                              cvId={cvId}
                              cvName={name}
                              cvComposite={composite}
                              {...{
        Severity: Minor
        Found in webpack/scenes/ContentViews/Table/ContentViewsTable.js and 1 other location - About 50 mins to fix
        webpack/scenes/ContentViews/Table/tableDataGenerator.js on lines 93..100

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

        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/ContentViews/Table/ContentViewsTable.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/AlternateContentSources/MainTable/ACSTable.js on lines 247..254

        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

                        <Td
                          expand={{
                            rowIndex,
                            isExpanded,
                            onToggle: (_event, _rInx, isOpen) =>
        Severity: Minor
        Found in webpack/scenes/ContentViews/Table/ContentViewsTable.js and 1 other location - About 30 mins to fix
        webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js on lines 536..542

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

        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