Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

File content_view_version.rb has 379 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Katello
  # rubocop:disable Metrics/ClassLength
  class ContentViewVersion < Katello::Model
    include Authorization::ContentViewVersion
    include ForemanTasks::Concerns::ActionSubject
Severity: Minor
Found in app/models/katello/content_view_version.rb - About 5 hrs to fix

    Function content has a Cognitive Complexity of 34 (exceeds 5 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: Minor
    Found in app/assets/javascripts/katello/sync_management/sync_management.js - About 5 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 SelectSource has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const SelectSource = () => {
      const {
        acsType, setAcsType, contentType, setContentType, setAuthentication,
      } = useContext(ACSCreateContext);
    
    
    Severity: Major
    Found in webpack/scenes/AlternateContentSources/Create/Steps/SelectSource.js - About 5 hrs to fix

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

        contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) {
          var oldPath = this.currentPath_;
          this.beginPath();
      
          this.moveTo(aX, aY);
      Severity: Major
      Found in app/assets/javascripts/katello/html5/excanvas.js and 1 other location - About 5 hrs to fix
      app/assets/javascripts/katello/html5/excanvas.js on lines 721..733

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

      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

        contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) {
          var oldPath = this.currentPath_;
          this.beginPath();
      
          this.moveTo(aX, aY);
      Severity: Major
      Found in app/assets/javascripts/katello/html5/excanvas.js and 1 other location - About 5 hrs to fix
      app/assets/javascripts/katello/html5/excanvas.js on lines 735..747

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

      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 sync_management.js has 376 lines of code (exceeds 250 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: Minor
      Found in app/assets/javascripts/katello/sync_management/sync_management.js - About 5 hrs to fix

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

        export const loadManifestHistory = (extendedParams = {}) => async (dispatch) => {
          dispatch({ type: MANIFEST_HISTORY_REQUEST });
        
          const params = {
            ...propsToSnakeCase(extendedParams),
        Severity: Major
        Found in webpack/scenes/Subscriptions/Manifest/ManifestActions.js and 4 other locations - About 5 hrs to fix
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 51..67
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 69..85
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 101..117
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 119..135

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

        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

        export const refreshManifest = (extendedParams = {}) => async (dispatch) => {
          dispatch({ type: REFRESH_MANIFEST_REQUEST });
        
          const params = {
            ...propsToSnakeCase(extendedParams),
        Severity: Major
        Found in webpack/scenes/Subscriptions/Manifest/ManifestActions.js and 4 other locations - About 5 hrs to fix
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 69..85
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 101..117
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 119..135
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 137..153

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

        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

        export const enableSimpleContentAccess = (extendedParams = {}) => async (dispatch) => {
          dispatch({ type: ENABLE_SIMPLE_CONTENT_ACCESS_REQUEST });
        
          const params = {
            ...propsToSnakeCase(extendedParams),
        Severity: Major
        Found in webpack/scenes/Subscriptions/Manifest/ManifestActions.js and 4 other locations - About 5 hrs to fix
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 51..67
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 69..85
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 119..135
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 137..153

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

        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

        export const disableSimpleContentAccess = (extendedParams = {}) => async (dispatch) => {
          dispatch({ type: DISABLE_SIMPLE_CONTENT_ACCESS_REQUEST });
        
          const params = {
            ...propsToSnakeCase(extendedParams),
        Severity: Major
        Found in webpack/scenes/Subscriptions/Manifest/ManifestActions.js and 4 other locations - About 5 hrs to fix
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 51..67
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 69..85
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 101..117
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 137..153

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

        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

        export const deleteManifest = (extendedParams = {}) => async (dispatch) => {
          dispatch({ type: DELETE_MANIFEST_REQUEST });
        
          const params = {
            ...propsToSnakeCase(extendedParams),
        Severity: Major
        Found in webpack/scenes/Subscriptions/Manifest/ManifestActions.js and 4 other locations - About 5 hrs to fix
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 51..67
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 101..117
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 119..135
        webpack/scenes/Subscriptions/Manifest/ManifestActions.js on lines 137..153

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

        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.certs = function () {
                    var deferred = $q.defer();
        
                    ContentCredential.queryUnpaged(function (contentCredentials) {
                        var results = contentCredentials.results;
        engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details-info.controller.js on lines 27..45

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

        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.gpgKeys = function () {
                    var deferred = $q.defer();
        
                    ContentCredential.queryUnpaged(function (contentCredentials) {
                        var results = contentCredentials.results;
        engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details-info.controller.js on lines 47..65

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

        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

                    success = function (response) {
                        var message = translate('Removed %x host collections from activation key "%y".')
                            .replace('%x', $scope.table.numSelected)
                            .replace('%y', $scope.activationKey.name);
        
        
        engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-add-host-collections.controller.js on lines 49..60

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

        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

                    success = function (response) {
                        var message = translate('Added %x host collections to activation key "%y".')
                            .replace('%x', $scope.table.numSelected)
                            .replace('%y', $scope.activationKey.name);
        
        
        engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-host-collections.controller.js on lines 49..60

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

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

        const RepositorySetsTab = () => {
          const hostDetails = useSelector(state => selectAPIResponse(state, 'HOST_DETAILS'));
          const {
            id: hostId,
            content_facet_attributes: contentFacetAttributes,

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

        import React from 'react';
        import { renderWithRedux, patientlyWaitFor, within, fireEvent } from 'react-testing-lib-wrapper';
        import { nockInstance, assertNockRequest, mockAutocomplete } from '../../../../../test-utils/nockWrapper';
        import katelloApi, { foremanApi } from '../../../../../services/api';
        import { REPOSITORY_SETS_KEY } from '../RepositorySetsTab/RepositorySetsConstants';

          File activation_keys_controller.rb has 368 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Katello
            class Api::V2::ActivationKeysController < Api::V2::ApiController  # rubocop:disable Metrics/ClassLength
              include Katello::Concerns::FilteredAutoCompleteSearch
              include Katello::Concerns::Api::V2::ContentOverridesController
              include Katello::Concerns::Api::V2::MultiCVParamsHandling
          Severity: Minor
          Found in app/controllers/katello/api/v2/activation_keys_controller.rb - About 4 hrs to fix

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

                          <FlexItem span={2}>
                            <Bullseye
                              onFocus={() => setEndEntry(true)}
                              onBlur={() => setEndEntry(false)}
                            >
            webpack/scenes/ContentViews/Details/Filters/CVErrataDateFilterContent.js on lines 208..224

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

            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

                          <FlexItem span={2} spacer={{ default: 'spacerNone' }}>
                            <Bullseye
                              onFocus={() => setStartEntry(true)}
                              onBlur={() => setStartEntry(false)}
                            >
            webpack/scenes/ContentViews/Details/Filters/CVErrataDateFilterContent.js on lines 230..246

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 131.

            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