Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

File contentViewPage.test.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable no-useless-escape */
import React from 'react';
import { renderWithRedux, patientlyWaitFor, fireEvent } from 'react-testing-lib-wrapper';

import CONTENT_VIEWS_KEY from '../ContentViewsConstants';
Severity: Minor
Found in webpack/scenes/ContentViews/__tests__/contentViewPage.test.js - About 3 hrs to fix

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

              {...{
                metadata,
                emptyContentTitle,
                emptyContentBody,
                emptySearchTitle,
    webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js on lines 446..466
    webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js on lines 479..499
    webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js on lines 297..316

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

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

              {...{
                metadata,
                emptyContentTitle,
                emptyContentBody,
                emptySearchTitle,
    webpack/components/extensions/HostDetails/Tabs/DebsTab/DebsTab.js on lines 439..459
    webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js on lines 479..499
    webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js on lines 297..316

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

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

              {...{
                metadata,
                emptyContentTitle,
                emptyContentBody,
                emptySearchTitle,
    webpack/components/extensions/HostDetails/Tabs/DebsTab/DebsTab.js on lines 439..459
    webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js on lines 446..466
    webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js on lines 297..316

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

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

          {...{
            metadata,
            emptyContentTitle,
            emptyContentBody,
            emptySearchTitle,
    webpack/components/extensions/HostDetails/Tabs/DebsTab/DebsTab.js on lines 439..459
    webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js on lines 446..466
    webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js on lines 479..499

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

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

    KT.env_content_view_selector = (function() {
        var env_div,
            content_view_div,
            selector_buttons_div,
            env_select,
    Severity: Minor
    Found in app/assets/javascripts/katello/widgets/env_content_view_selector.js - About 2 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 EmptyStateMessage has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    const EmptyStateMessage = ({
      title, body, error, search,
      customIcon, happy, ...extraTableProps
    }) => {
      let emptyStateTitle = title;
    Severity: Minor
    Found in webpack/components/Table/EmptyStateMessage.js - About 2 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 CVErrataDateFilterContent has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    const CVErrataDateFilterContent = ({
      cvId, filterId, inclusion, showAffectedRepos, setShowAffectedRepos, details,
    }) => {
      const { push } = useHistory();
      const filterDetails = useSelector(state =>

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

      componentDidUpdate(prevProps) {
        const {
          handleStartTask,
          handleFinishedTask,
          isTaskPending,
    Severity: Minor
    Found in webpack/scenes/Subscriptions/SubscriptionsPage.js - About 2 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

    Method find_version_environments has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def find_version_environments
          #Generates a data structure for incremental update:
          # [{:content_view_version => ContentViewVersion, :environments => [KTEnvironment]}]
    
          list = params[:content_view_version_environments]
    Severity: Minor
    Found in app/controllers/katello/api/v2/content_view_versions_controller.rb - About 2 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

    File TracesTab.js has 288 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useState, useCallback } from 'react';
    import { FormattedMessage } from 'react-intl';
    import {
      Skeleton, Split, SplitItem, ActionList, ActionListItem, Dropdown,
      DropdownItem, DropdownToggle, DropdownToggleAction, Alert,
    Severity: Minor
    Found in webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesTab.js - About 2 hrs to fix

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

      export const renderRexJobFailedToast = ({ id, description }) => {
        if (!id) return;
      
        const message = (__(`Remote execution job '${description}' failed.`));
      
      
      Severity: Major
      Found in webpack/scenes/Tasks/helpers.js and 1 other location - About 2 hrs to fix
      webpack/scenes/Tasks/helpers.js on lines 81..91

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

      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

              $scope.removeHostCollection = function (hostCollection) {
                  hostCollection.$delete(function () {
                      $scope.transitionTo('host-collections');
                      Notification.setSuccessMessage(translate('Host Collection removed.'));
                  }, function (response) {
      engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js on lines 80..87

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

      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 renderRexJobSucceededToast = ({ id, description }) => {
        if (!id) return;
      
        const message = (__(`Job '${description}' completed`));
      
      
      Severity: Major
      Found in webpack/scenes/Tasks/helpers.js and 1 other location - About 2 hrs to fix
      webpack/scenes/Tasks/helpers.js on lines 69..79

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

      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

              $scope.removeActivationKey = function (activationKey) {
                  activationKey.$delete(function () {
                      $scope.transitionTo('activation-keys');
                      Notification.setSuccessMessage(translate('Activation Key removed.'));
                  }, function (response) {
      engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-details.controller.js on lines 102..109

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

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

        contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) {
          var m = this.m_,
              delta = 1000,
              left = 0,
              right = delta,
      Severity: Major
      Found in app/assets/javascripts/katello/html5/excanvas.js - About 2 hrs to fix

        File CVPackageGroupFilterContent.js has 286 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { useState, useEffect, useCallback } from 'react';
        import useDeepCompareEffect from 'use-deep-compare-effect';
        import PropTypes from 'prop-types';
        import { shallowEqual, useSelector, useDispatch } from 'react-redux';
        import { TableVariant } from '@patternfly/react-table';

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

            await patientlyWaitFor(() => {
              expect(getAllByText(firstPackage.name)[0]).toBeInTheDocument();
              expect(getAllByText(firstPackage.version)[0]).toBeInTheDocument();
              expect(getAllByText(firstPackage.filename)[0]).toBeInTheDocument();
            });
          Severity: Major
          Found in webpack/scenes/Content/__tests__/contentTable.test.js and 1 other location - About 2 hrs to fix
          webpack/scenes/Content/__tests__/contentTable.test.js on lines 68..72

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

          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 ModuleStreamDetailProfiles = ({ profiles }) => (
            <div>
              <Table.PfProvider columns={TableSchema}>
                <Table.Header />
                <Table.Body rows={profiles} rowKey="id" />
          webpack/components/Content/Details/ContentDetailRepositories.js on lines 6..13

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

          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

                {!alertDismissed && deleteFlow &&
                  <Alert
                    ouiaId="delete-version-info-alert"
                    variant="warning"
                    isInline
          webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVVersionRemoveReview.js on lines 30..39

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

          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