Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

Method plan has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(content_view, options)
          cv_envs = options.fetch(:content_view_environments, [])
          versions = options.fetch(:content_view_versions, [])
          organization_destroy = options.fetch(:organization_destroy, false)
          skip_repo_destroy = options.fetch(:skip_repo_destroy, false)
Severity: Minor
Found in app/lib/actions/katello/content_view/remove.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

Method plan has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(repository, uploads, options = {})
          action_subject(repository)
          repository.clear_smart_proxy_sync_histories
          repo_service = repository.backend_service(::SmartProxy.pulp_primary)

Severity: Minor
Found in app/lib/actions/katello/repository/import_upload.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

Method plan has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(root, relative_path = nil)
          repository = ::Katello::Repository.new(:environment => root.organization.library, :content_view_version => root.organization.library.default_content_view_version, :root => root)
          #Container push may concurrently call root add several times before the db can update.
          # If the root already exists, we can skip the creation of the root and repository.
          # We acquire a lock on the product to ensure that the root is not created multiple times by different workers.
Severity: Minor
Found in app/lib/actions/katello/repository/create_container_push_root.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

Method plan has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

          def plan(repository, smart_proxy, options = {})
            force_publication = options.fetch(:force_publication, repository.publication_href.nil?)

            options[:contents_changed] = (options && options.key?(:contents_changed)) ? options[:contents_changed] : true
            publication_content_type = !::Katello::RepositoryTypeManager.find(repository.content_type).pulp3_skip_publication
Severity: Minor
Found in app/lib/actions/pulp3/orchestration/repository/generate_metadata.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

Method finalize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

        def finalize # rubocop:disable Metrics/AbcSize
          content_view = ::Katello::ContentView.find(input[:content_view_id])
          environment = ::Katello::KTEnvironment.find(input[:environment_id])
          content_ids = content_view.repos(environment).map(&:content_id).uniq.compact
          # in case we create new custom repository that doesn't have the
Severity: Minor
Found in app/lib/actions/candlepin/environment/set_content.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

Method commit_session has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def commit_session(env, status, headers, body)
    session = env['rack.session']
    options = env['rack.session.options']

    if options[:drop] || options[:renew]
Severity: Minor
Found in lib/katello/url_constrained_cookie_store.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

Method run has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

        def run
          return if input[:tasks].empty?
          version_hrefs = input[:tasks].last[:created_resources]
          repositories = find_repositories(input[:repository_ids])

Severity: Minor
Found in app/lib/actions/pulp3/repository/save_versions.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 SystemPurposeEditModal.test.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import { propsToCamelCase } from 'foremanReact/common/helpers';
import { renderWithRedux, patientlyWaitFor, fireEvent } from 'react-testing-lib-wrapper';
import HOST_DETAILS from '../../../HostDetailsConstants';
import SystemPurposeEditModal from '../SystemPurposeEditModal';

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

                  <Tr key={`${nva}_${description}_${id}`} ouiaId={`${nva}-${id}-tr`}>
                    <Td>
                      <a rel="noreferrer" target="_blank" href={urlBuilder(`debs/${id}`, '')}>{nva}</a>
                    </Td>
                    <Td>{description}</Td>
    webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVRpmMatchContentModal.js on lines 87..92

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

    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 {
        name,
        alternate_content_source_type: acsType,
        content_type: contentType,
        subpaths,
    webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsModal.js on lines 150..166

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

    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

                  <Tr key={`${nvra}_${summary}_${id}`} ouiaId={`${nvra}_${summary}_${id}`}>
                    <Td>
                      <a rel="noreferrer" target="_blank" href={urlBuilder(`packages/${id}`, '')}>{nvra}</a>
                    </Td>
                    <Td>{summary}</Td>
    webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVDebMatchContentModal.js on lines 73..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 76.

    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

            {...{
              metadata,
              emptyContentTitle,
              emptyContentBody,
              emptySearchTitle,
    webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 70..86

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

    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

          {!composite &&
            <FormGroup isInline fieldId="dependencies">
              <Checkbox
                id="dependencies"
                ouiaId="dependencies"
    Severity: Major
    Found in webpack/scenes/ContentViews/Create/CreateContentViewForm.js and 1 other location - About 2 hrs to fix
    webpack/scenes/ContentViews/Create/CreateContentViewForm.js on lines 171..181

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

    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

          {composite &&
            <FormGroup isInline fieldId="autoPublish">
              <Checkbox
                id="autoPublish"
                ouiaId="autoPublish"
    Severity: Major
    Found in webpack/scenes/ContentViews/Create/CreateContentViewForm.js and 1 other location - About 2 hrs to fix
    webpack/scenes/ContentViews/Create/CreateContentViewForm.js on lines 160..170

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

    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 mockForemanAutocomplete = (
      instance,
      autoCompUrl,
      query = true,
      response = [],
    Severity: Major
    Found in webpack/test-utils/nockWrapper.js and 1 other location - About 2 hrs to fix
    webpack/test-utils/nockWrapper.js on lines 45..55

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

    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 mockAutocomplete = (
      instance,
      autoCompUrl,
      query = true,
      response = [],
    Severity: Major
    Found in webpack/test-utils/nockWrapper.js and 1 other location - About 2 hrs to fix
    webpack/test-utils/nockWrapper.js on lines 57..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 76.

    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 AddEditPackageRuleModal.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useState } from 'react';
    import useDeepCompareEffect from 'use-deep-compare-effect';
    import { useDispatch, useSelector } from 'react-redux';
    import { STATUS } from 'foremanReact/constants';
    import PropTypes from 'prop-types';

      Function menuSetup has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          menuSetup: function(){
            //set some useful vars
            var topLevel = $('#appnav li.top_level');
            var secondLevel = $('#subnav').find('ul');
            var activeSubnav = secondLevel.find(".selected").first().parent();
      Severity: Major
      Found in app/assets/javascripts/katello/common/menu.js - About 2 hrs to fix

        Function ContentDetails has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const ContentDetails = () => {
          const dispatch = useDispatch();
          const contentDetailsResponse = useSelector(selectContentDetails);
          const contentDetailsResponseStatus = useSelector(selectContentDetailsStatus);
        
        
        Severity: Major
        Found in webpack/scenes/Content/Details/ContentDetails.js - About 2 hrs to fix

          Function monitorTask has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  resource.monitorTask = function (task) {
                      var searchId, deferred = $q.defer();
                      var runningTask = {
                          // promise that the task finishes, rejected when some
                          // error occurs
            Severity
            Category
            Status
            Source
            Language