Katello/katello

View on GitHub

Showing 2,689 of 2,689 total issues

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

                <Split hasGutter>
                  <SplitItem>
                    <Button
                      ouiaId="create-deb-rule-button"
                      onClick={() => setModalOpen(true)}
webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js on lines 209..233

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

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

test('Toggle Group shows if it\'s the library environment but non-default content view', async (done) => {
  // Setup autocomplete with mockForemanAutoComplete since we aren't adding /katello
  const autocompleteScope = mockForemanAutocomplete(nockInstance, autocompleteUrl);
  const mockErrata = makeMockErrata({});
  const options = renderOptions({
webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js on lines 578..602

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

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

test('Toggle Group shows if it\'s the default content view but non-library environment', async (done) => {
  // Setup autocomplete with mockForemanAutoComplete since we aren't adding /katello
  const autocompleteScope = mockForemanAutocomplete(nockInstance, autocompleteUrl);
  const mockErrata = makeMockErrata({});
  const options = renderOptions({
webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js on lines 604..629

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

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

                  <Split hasGutter>
                    <SplitItem>
                      <Button
                        ouiaId="add-rpm-rule-button"
                        onClick={() => setModalOpen(true)}
webpack/scenes/ContentViews/Details/Filters/CVDebFilterContent.js on lines 189..220

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

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

KT.content = (function () {
  var draw_syncing = function (repo_id, progress, task_id) {
      var element = $("#repo-" + repo_id).find(".result"),
        cancelButton = $("<a/>").attr("class", "cancel_sync").text(katelloI18n.cancel),
        progressBar = $("<a/>").attr("class", "progress").text(" ");
Severity: Major
Found in app/assets/javascripts/katello/sync_management/sync_management.js - About 1 day to fix

    File ACSExpandableDetails.js has 510 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useState } from 'react';
    import PropTypes from 'prop-types';
    import useDeepCompareEffect from 'use-deep-compare-effect';
    import { useDispatch, useSelector } from 'react-redux';
    import { useParams } from 'react-router-dom';

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

            {(selectedEnv.length !== 0) &&
              <>
                <h3>{__('Environments')}</h3>
                <Flex>
                  <FlexItem><ExclamationTriangleIcon /></FlexItem>
      webpack/scenes/ContentViews/Delete/Steps/CVDeletionReview.js on lines 30..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 199.

      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

            {(cvEnvironments.length !== 0) &&
              <>
                <h3>{__('Environments')}</h3>
                <Flex>
                  <FlexItem><ExclamationTriangleIcon /></FlexItem>
      Severity: Major
      Found in webpack/scenes/ContentViews/Delete/Steps/CVDeletionReview.js and 1 other location - About 1 day to fix
      webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVVersionRemoveReview.js on lines 41..52

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

      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

      File host_managed_extensions.rb has 497 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Katello
        module Concerns
          # rubocop:disable Metrics/ModuleLength
          module HostManagedExtensions
            extend ActiveSupport::Concern
      Severity: Minor
      Found in app/models/katello/concerns/host_managed_extensions.rb - About 7 hrs to fix

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

                  <FormGroup
                    label={__('SSL client certificate')}
                    type="string"
                    fieldId="client_cert"
                  >
        webpack/scenes/AlternateContentSources/Create/Steps/ACSCredentials.js on lines 146..175

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

        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

                  <FormGroup
                    label={__('SSL client key')}
                    type="string"
                    fieldId="client_key"
                  >
        webpack/scenes/AlternateContentSources/Create/Steps/ACSCredentials.js on lines 116..145

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

        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

        Method load_errata_applications has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
        Open

              def load_errata_applications(filter_errata_type: nil, include_last_reboot: 'yes', since: nil, up_to: nil, status: nil, host_filter: nil)
                result = []
        
                filter_errata_type = filter_errata_type.presence || 'all'
                search_up_to = up_to.present? ? "ended_at < \"#{up_to}\"" : nil
        Severity: Minor
        Found in app/lib/katello/concerns/base_template_scope_extensions.rb - About 7 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Class RegistryProxiesController has 54 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Api::Registry::RegistryProxiesController < Api::V2::ApiController
            before_action :disable_strong_params
            before_action :confirm_settings
            skip_before_action :authorize
            before_action :optional_authorize, only: [:token, :catalog]
        Severity: Major
        Found in app/controllers/katello/api/registry/registry_proxies_controller.rb - About 7 hrs to fix

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

          test('Can call API for installable packages and show on screen on page load', async (done) => {
            const autocompleteScope = mockForemanAutocomplete(nockInstance, autocompleteUrl);
          
            const scope = nockInstance
              .get(hostYumInstallablePackages)
          webpack/components/extensions/HostDetails/Tabs/__tests__/debsInstallModal.test.js on lines 59..81

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

          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

          test('Can call API for installable deb packages and show on screen on page load', async (done) => {
            const autocompleteScope = mockForemanAutocomplete(nockInstance, autocompleteUrl);
          
            const scope = nockInstance
              .get(hostInstallableDebs)
          webpack/components/extensions/HostDetails/Tabs/__tests__/packageInstallModal.test.js on lines 61..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 188.

          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

            await patientlyWaitFor(() => {
              expect(queryByText('test_acs3')).toBeInTheDocument();
              expect(queryByText('Details')).toBeInTheDocument();
              expect(getByLabelText('edit-details-pencil-edit')).toBeInTheDocument();
              expect(queryByText('Smart proxies')).toBeInTheDocument();
          webpack/scenes/AlternateContentSources/Details/__tests__/ACSEdits.test.js on lines 215..225

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

          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

            await patientlyWaitFor(() => {
              expect(queryByText('test_acs3')).toBeInTheDocument();
              expect(queryByText('Details')).toBeInTheDocument();
              expect(getByLabelText('edit-details-pencil-edit')).toBeInTheDocument();
              expect(queryByText('Smart proxies')).toBeInTheDocument();
          webpack/scenes/AlternateContentSources/Details/__tests__/ACSEdits.test.js on lines 167..177

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

          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

          Class Core has 53 methods (exceeds 20 allowed). Consider refactoring.
          Open

                class Core
                  attr_accessor :smart_proxy, :repository_type
          
                  def initialize(smart_proxy, repository_type = Katello::RepositoryTypeManager.find_by(:pulp3_api_class, self.class))
                    @smart_proxy = smart_proxy
          Severity: Major
          Found in app/services/katello/pulp3/api/core.rb - About 7 hrs to fix

            Class CandlepinProxiesController has 53 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Api::Rhsm::CandlepinProxiesController < Api::V2::ApiController
                include Katello::Authentication::ClientAuthentication
            
                IF_MODIFIED_SINCE_HEADER = 'If-Modified-Since'.freeze
            
            
            Severity: Major
            Found in app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb - About 7 hrs to fix

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

                      <DataListItem key="headers" >
                        <DataListItemRow>
                          <DataListItemCells dataListCells={[
                            <DataListCell key="primary content">
                              <b>{__('Repository')}</b>
              Severity: Major
              Found in webpack/scenes/SmartProxy/ExpandedSmartProxyRepositories.js and 1 other location - About 7 hrs to fix
              webpack/scenes/SmartProxy/ExpandedSmartProxyRepositories.js on lines 91..103

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

              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