Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

Function SystemPurposeCard has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

const SystemPurposeCard = ({ hostDetails, akDetails }) => {
  const sysPurposeCardType = hostDetails?.id ? 'host' : 'ak';
  const isAKType = sysPurposeCardType === 'ak';
  const isHostType = sysPurposeCardType === 'host';
  const details = isHostType ? hostDetails : akDetails;

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

KT.path_select = function(div_id, name, environments, options_in){

    var div,
        scroll_obj,
        paths_id,
Severity: Minor
Found in app/assets/javascripts/katello/widgets/path_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 NetworkSyncForm has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

const NetworkSyncForm = ({
  typeChangeInProgress, contentCredentials, cdnConfiguration, onUpdate,
}) => {
  const dispatch = useDispatch();
  const cdnConfigurationObject = propsToCamelCase(cdnConfiguration);

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

          def deliver!
            ::Organization.unscoped.all.each do |organization|
              if (notification = existing_notification(organization))
                days_remaining = organization.manifest_expire_days_remaining
                if days_remaining == 0 || days_remaining > Setting[:expire_soon_days].to_i

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

    def custom_index_relation(collection)
      collection = filter_by_cve(params[:cve], collection) if params[:cve]
      applicable = ::Foreman::Cast.to_bool(params[:errata_restrict_applicable]) || @host
      installable = ::Foreman::Cast.to_bool(params[:errata_restrict_installable])
      if applicable || installable
Severity: Minor
Found in app/controllers/katello/api/v2/errata_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

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

        def run
          repo = ::Katello::Repository.find(input[:id])
          if repo.docker?
            ::Katello::DockerManifest.import_for_repository(repo)
            ::Katello::DockerTag.import_for_repository(repo)
Severity: Minor
Found in app/lib/actions/katello/repository/filtered_index_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 plan has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(smart_proxy, options = {})
          plan_self(:smart_proxy_id => smart_proxy.id)
          action_subject(smart_proxy)
          environment = options[:environment]
          content_view = options[:content_view]
Severity: Minor
Found in app/lib/actions/katello/capsule_content/sync_capsule.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 SubscriptionsTable.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { cloneDeep, findIndex, isEqual } from 'lodash';
import { translate as __ } from 'foremanReact/common/I18n';
import { LoadingState } from '../../../../components/LoadingState';

    Function startUpdater has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        startUpdater = function () {
          if (syncing.length === 0) {
            return;
          }
          var url = tfm.tools.foremanUrl("/katello/sync_management/sync_status");
    Severity: Major
    Found in app/assets/javascripts/katello/sync_management/sync_management.js - About 2 hrs to fix

      Function CVVersionRemoveReview has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const CVVersionRemoveReview = () => {
        const [alertDismissed, setAlertDismissed] = useState(false);
        const {
          cvId, versionNameToRemove, versionEnvironments, selectedEnvSet,
          selectedEnvForAK, selectedCVNameForAK, selectedCVNameForHosts,

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

                      {canEdit &&
                      <SplitItem>
                        <Button
                          ouiaId="edit-products-pencil-edit"
                          aria-label="edit-products-pencil-edit"
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 111..123
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 191..203
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 316..328
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 377..389

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                    {canEdit &&
                    <SplitItem>
                      <Button
                        ouiaId="edit-smart-proxies-pencil-edit"
                        aria-label="edit-smart-proxies-pencil-edit"
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 111..123
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 262..274
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 316..328
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 377..389

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                      {canEdit &&
                      <SplitItem>
                        <Button
                          ouiaId="edit-urls-pencil-edit"
                          aria-label="edit-urls-pencil-edit"
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 111..123
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 191..203
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 262..274
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 377..389

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                    {canEdit &&
                    <SplitItem>
                      <Button
                        ouiaId="edit-details-pencil-edit"
                        aria-label="edit-details-pencil-edit"
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 191..203
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 262..274
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 316..328
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 377..389

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                      {canEdit &&
                      <SplitItem>
                        <Button
                          ouiaId="edit-credentials-pencil-edit"
                          aria-label="edit-credentials-pencil-edit"
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 111..123
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 191..203
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 262..274
        webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js on lines 316..328

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          const onSubmit = () => {
            setSaving(true);
            dispatch(editACS(
              acsId,
              { acsId, name: acsName, description: acsDescription },
        webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditSmartProxies.js on lines 57..70

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        const ContentSourceForm = ({
          handleSubmit,
          environments,
          handleEnvironment,
          contentViews,
        webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js on lines 14..101

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        const SubscriptionsToolbar = ({
          canManageSubscriptionAllocations,
          disableManifestActions,
          disableManifestReason,
          disableDeleteButton,
        webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceForm.js on lines 88..313

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          const modalActions = ([
            <InstallDropdown
              key="install"
              isDisabled={!selectedCount}
              installViaRex={installViaRex}
        webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackageInstallModal.js on lines 144..154

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                    self.getDeselected = function () {
                        var deselectedRows = [];
                        angular.forEach(self.table.rows, function (row, rowIndex) {
                            if (row.selected !== true) {
                                deselectedRows.push(self.table.rows[rowIndex]);
        engines/bastion/app/assets/javascripts/bastion/components/bst-table.directive.js on lines 73..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 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language