Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

Function render has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const {
      list,
      loading,
    } = this.props;
Severity: Minor
Found in webpack/components/SelectOrg/SetOrganization.js - About 1 hr to fix

    Function RepositoriesFilters has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function RepositoriesFilters() {
    
            /**
             * modify params depending upon environment and content-view filters
             *

      Method check_blob_push_org_label has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def check_blob_push_org_label(props)
            org_label = props[:organization]
            unless org_label.present? && org_label.length > 0
              return render_podman_error(
                "NAME_INVALID",
      Severity: Minor
      Found in app/controllers/katello/api/registry/registry_proxies_controller.rb - About 1 hr to fix

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

          await patientlyWaitFor(() => {
            expect(queryByText('test_acs')).toBeInTheDocument();
            expect(queryByText('Details')).toBeInTheDocument();
            expect(getByLabelText('edit-details-pencil-edit')).toBeInTheDocument();
          });
        webpack/scenes/AlternateContentSources/Details/__tests__/ACSEdits.test.js on lines 74..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 71.

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

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

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

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

        Refactorings

        Further Reading

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

            if (!cvInEnvLoading && results && selectedCVForAK &&
              results.filter(cv => cv.id === selectedCVForAK && contentViewEligible(cv)).length === 0) {
              setSelectedCVForAK(null);
              setSelectedCVNameForAK(null);
            }
        webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignHostsForm.js on lines 47..51
        webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignActivationKeysForm.js on lines 66..70
        webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignHostsForm.js on lines 54..58

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

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

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

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

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

        Refactorings

        Further Reading

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

            if (!cvInEnvLoading && results && selectedCVForHosts &&
              results.filter(cv => cv.id === selectedCVForHosts && contentViewEligible(cv)).length === 0) {
              setSelectedCVForHosts(null);
              setSelectedCVNameForHosts(null);
            }
        webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignActivationKeysForm.js on lines 57..61
        webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignActivationKeysForm.js on lines 66..70
        webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignHostsForm.js on lines 54..58

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

        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

          const {
            searchQuery,
            updateSearchQuery,
            isSelected,
            selectOne,
        webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackageInstallModal.js on lines 100..111

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

        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_acs')).toBeInTheDocument();
            expect(queryByText('Details')).toBeInTheDocument();
            expect(getByLabelText('edit-details-pencil-edit')).toBeInTheDocument();
          });
        webpack/scenes/AlternateContentSources/Details/__tests__/ACSEdits.test.js on lines 121..125

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

        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

          const {
            searchQuery,
            updateSearchQuery,
            isSelected,
            selectOne,
        webpack/components/extensions/HostDetails/Tabs/DebsTab/DebInstallModal.js on lines 100..111

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

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

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

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

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

        Refactorings

        Further Reading

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

            if (!cvInEnvLoading && results && selectedCVForHosts &&
              results.filter(cv => cv.id === selectedCVForHosts && contentViewEligible(cv)).length === 0) {
              setSelectedCVForHosts(null);
              setSelectedCVNameForHosts(null);
            }
        webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignActivationKeysForm.js on lines 57..61
        webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignHostsForm.js on lines 47..51
        webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignActivationKeysForm.js on lines 66..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 71.

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

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

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

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

        Refactorings

        Further Reading

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

            if (!cvInEnvLoading && results && selectedCVForAK &&
              results.filter(cv => cv.id === selectedCVForAK && contentViewEligible(cv)).length === 0) {
              setSelectedCVForAK(null);
              setSelectedCVNameForAK(null);
            }
        webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignActivationKeysForm.js on lines 57..61
        webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignHostsForm.js on lines 47..51
        webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignHostsForm.js on lines 54..58

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

        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

          useDeepCompareEffect(
            () => {
              if (selectedEnvForHost.length) {
                dispatch(getContentViews({
                  environment_id: selectedEnvForHost[0].id,
        webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignActivationKeysForm.js on lines 29..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 71.

        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

          await patientlyWaitFor(() => {
            expect(getAllByLabelText('Actions')[0]).toHaveAttribute('aria-expanded', 'true');
            expect(queryByText('Remove')).toBeInTheDocument();
            fireEvent.click(queryByText('Remove'));
          });
        webpack/scenes/ContentViews/Details/Filters/__tests__/CVContainerImageFilterContent.test.js on lines 247..251

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

        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={__('Content view label')}
                >
                  <TextInput
                    ouiaId="network-sync-content-view-input"
        webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/NetworkSyncForm.js on lines 203..214

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

        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={__('Lifecycle Environment Label')}
                >
                  <TextInput
                    ouiaId="network-sync-lifecycle-environment-input"
        webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/NetworkSyncForm.js on lines 215..226

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

        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

          await patientlyWaitFor(() => {
            expect(getAllByLabelText('Actions')[0]).toHaveAttribute('aria-expanded', 'true');
            expect(queryByText('Edit')).toBeInTheDocument();
            fireEvent.click(queryByText('Edit'));
          });
        webpack/scenes/ContentViews/Details/Filters/__tests__/CVContainerImageFilterContent.test.js on lines 115..119

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

        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

          useDeepCompareEffect(
            () => {
              if (selectedEnvForAK.length) {
                dispatch(getContentViews({
                  environment_id: selectedEnvForAK[0].id,
        webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignHostsForm.js on lines 30..42

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

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

            function NewEnvironmentController($scope, Environment, FormUtils, Notification, PathsService, translate) {
        
                function success() {
                    $scope.transitionTo('environments');
                }

          Method plan has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def plan(root, repo_params)
                    repository = root.library_instance
                    action_subject root.library_instance
          
                    repo_params[:url] = nil if repo_params[:url] == ''
          Severity: Minor
          Found in app/lib/actions/katello/repository/update.rb - About 1 hr to fix

            Function CustomCdnTypeForm has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            const CustomCdnTypeForm = ({
              typeChangeInProgress, onUpdate, contentCredentials, cdnConfiguration,
            }) => {
              const dispatch = useDispatch();
              const urlValue = cdnConfiguration.type === CUSTOM_CDN ? cdnConfiguration.url : '';

            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

            Severity
            Category
            Status
            Source
            Language