Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

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

Content.propTypes = {
  smartProxyId: PropTypes.oneOfType([
    PropTypes.number,
    PropTypes.string, // The API can sometimes return strings
  ]),
Severity: Major
Found in webpack/scenes/SmartProxy/Content.js and 1 other location - About 1 hr to fix
webpack/scenes/ContentViews/components/WizardHeader.js on lines 27..36

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

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

        $q.all([contentView.$promise, environment.$promise]).then(function () {
            $scope.filterPackages();
            $scope.table.working = false;
        });
engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/erratum-repositories.controller.js on lines 51..54

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

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

        {contentHosts.length > 0 && (<Label color="green" href="#" onClick={() => setModalHosts(true)}>{titleHosts}: {contentHosts.length}</Label>)}
webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js on lines 31..31

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

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

        <WizardStep
          name={__('Review hosts')}
          id="mpw-step-3"
          status={step3Valid ? 'default' : 'error'}
          footer={{ isNextDisabled: !step4Valid || !packagesResultsPresent, onClose: closeModal }}
webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/BulkErrataWizard.js on lines 131..143

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

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

        {hostsWithoutContent.length > 0 && (<Label color="orange" href="#" onClick={() => setModalIgnored(true)}>{titleIgnored}: {hostsWithoutContent.length}</Label>)}
webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js on lines 29..29

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

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

        <WizardStep
          name={__('Review hosts')}
          id="mew-step-3"
          status={step3Valid ? 'default' : 'error'}
          footer={{ isNextDisabled: !step4Valid || !errataResultsPresent, onClose: closeModal }}
webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/BulkPackagesWizard.js on lines 230..243

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

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

    if (repoSetsSearch !== null) {
      const setsParams = {
        perPage: this.props.repositorySets.pagination.perPage,
        search: repoSetsSearch,
      };
Severity: Major
Found in webpack/scenes/RedHatRepositories/components/SearchBar.js and 1 other location - About 1 hr to fix
webpack/scenes/RedHatRepositories/components/SearchBar.js on lines 91..97

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

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

    def custom_index_relation(collection)
      applicable = ::Foreman::Cast.to_bool(params[:packages_restrict_applicable]) || params[:host_id]
      upgradable = ::Foreman::Cast.to_bool(params[:packages_restrict_upgradable])
      not_installed = ::Foreman::Cast.to_bool(params[:packages_restrict_not_installed])
      if upgradable
Severity: Major
Found in app/controllers/katello/api/v2/packages_controller.rb and 1 other location - About 1 hr to fix
app/controllers/katello/api/v2/debs_controller.rb on lines 89..103

Duplicated Code

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

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

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

Tuning

This issue has a mass of 55.

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

    def custom_index_relation(collection)
      applicable = ::Foreman::Cast.to_bool(params[:packages_restrict_applicable]) || params[:host_id]
      upgradable = ::Foreman::Cast.to_bool(params[:packages_restrict_upgradable])
      not_installed = ::Foreman::Cast.to_bool(params[:packages_restrict_not_installed])

Severity: Major
Found in app/controllers/katello/api/v2/debs_controller.rb and 1 other location - About 1 hr to fix
app/controllers/katello/api/v2/packages_controller.rb on lines 65..77

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

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

  const handleSave = (event) => {
    event.preventDefault();
    closeModal();
    const optionsToValue = (options, stateValue) =>
      options.find(option => option.value === stateValue)?.value;

    Function result_select has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        Chosen.prototype.result_select = function(evt) {
          var high, high_id, item, position;
          if (this.result_highlight) {
            high = this.result_highlight;
            high_id = high.attr("id");
    Severity: Minor
    Found in app/assets/javascripts/katello/common/chosen.jquery.js - About 1 hr to fix

      Function removeHostCollections has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              $scope.removeHostCollections = function () {
                  var data,
                      success,
                      error,
                      deferred = $q.defer(),

        Function ACSProducts has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const ACSProducts = () => {
          const {
            setProductIds, productNames, setProductNames,
          } = useContext(ACSCreateContext);
          const availableProducts = useSelector(selectProducts);
        Severity: Minor
        Found in webpack/scenes/AlternateContentSources/Create/Steps/ACSProducts.js - About 1 hr to fix

          Method message has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def message
                # Retrieve a text message that may be rendered for a task's status.  This is used in various places,
                # such as System Event history.
                details = TaskStatus::TYPES[self.task_type]
                return _("Non-system event") if details.nil?
          Severity: Minor
          Found in app/models/katello/task_status.rb - About 1 hr to fix

            Method index has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def index
                  unless params[:content_type].empty? || RepositoryTypeManager.find(params[:content_type])
                    msg = _("Invalid params provided - content_type must be one of %s") %
                      RepositoryTypeManager.enabled_repository_types.keys.sort.join(",")
                    fail HttpErrors::UnprocessableEntity, msg
            Severity: Minor
            Found in app/controllers/katello/api/v2/repositories_controller.rb - About 1 hr to fix

              Method parse_repositories has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def parse_repositories(repositories)
                        repositories.map do |pulp_name, repo|
                          if repo[:content]
                            content =  MetadataRepositoryContent.new(id: repo[:content][:id],
                                                                     label: repo[:content][:label],
              Severity: Minor
              Found in app/services/katello/pulp3/content_view_version/metadata_map.rb - About 1 hr to fix

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

                        def plan(repository, content_units, options = {})
                          repository.check_ready_to_act!
                          sync_capsule = options.fetch(:sync_capsule, true)
                          if repository.redhat?
                            fail _("Cannot remove content from a non-custom repository")
                Severity: Minor
                Found in app/lib/actions/katello/repository/remove_content.rb - About 1 hr to fix

                  Method invoke_external_task has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def invoke_external_task
                            repository = ::Katello::Repository.find(input[:repository_id])
                            artifact_href = input[:options][:artifact_href] || fetch_artifact_href
                            fail _("Content not uploaded to pulp") unless artifact_href
                            content_type = input[:unit_type_id]
                  Severity: Minor
                  Found in app/lib/actions/pulp3/repository/save_artifact.rb - About 1 hr to fix

                    Method subscription_permissions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def subscription_permissions
                          @plugin.permission :view_subscriptions,
                                             {
                                               'katello/api/v2/subscriptions' => [:index, :show, :available, :manifest_history, :auto_complete_search]
                                             },
                    Severity: Minor
                    Found in lib/katello/permission_creator.rb - About 1 hr to fix

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

                                def plan(target_repo, smart_proxy, source_repositories, options = {})
                                  filter_ids = options.fetch(:filters, nil)&.map(&:id)
                                  rpm_filenames = options.fetch(:rpm_filenames, nil)
                                  solve_dependencies = options.fetch(:solve_dependencies, false)
                      
                      
                      Severity: Minor
                      Found in app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language