Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

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

  subscriptions: PropTypes.shape({
    searchIsActive: PropTypes.bool,
    itemCount: PropTypes.number,
    pagination: PropTypes.shape({}),
    // Disabling rule as existing code failed due to an eslint-plugin-react update
webpack/scenes/RedHatRepositories/RedHatRepositoriesPage.js on lines 137..144

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

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

  repositorySets: PropTypes.shape({
    recommended: PropTypes.bool,
    loading: PropTypes.bool,
    search: PropTypes.shape({}),
    // Disabling rule as existing code failed due to an eslint-plugin-react update
Severity: Major
Found in webpack/scenes/RedHatRepositories/RedHatRepositoriesPage.js and 1 other location - About 1 hr to fix
webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Table.js on lines 101..108

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

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 katelloPackageUpdateParams = ({ hostname, packageName, descriptionFormat }) =>
  baseParams({
    hostname,
    inputs: { package: packageName },
    feature: REX_FEATURES.KATELLO_PACKAGE_UPDATE,
webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js on lines 76..82

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

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: first(selectedEnvForAK).id,
webpack/scenes/ContentViews/Details/Versions/BulkDelete/Steps/ReassignHosts.js on lines 64..75

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

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 scopeContentTypes = testConfigViewByDifferent.map(({ dataUrl, data }) =>
    nockInstance.persist().get(dataUrl).query(true).reply(200, data));
webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/CVVersionCompare.test.js on lines 617..618

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

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

Consider simplifying this complex logical expression.
Open

          if source_repo.content_type == ::Katello::Repository::YUM_TYPE
            srpms_match = srpms_match?(source_repo, target_repo)
            rpms = rpms_match?(source_repo, target_repo)
            errata = errata_match?(source_repo, target_repo)
            package_groups = package_groups_match?(source_repo, target_repo)
Severity: Critical
Found in app/lib/actions/katello/repository/check_matching_content.rb - About 1 hr to fix

    Function wrapper has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        wrapper: (hostDetails) => {
          const contentViewEnvironments =
            hostDetails?.content_facet_attributes?.content_view_environments ?? [];
          if (contentViewEnvironments.length === 0) return '—'; // don't show popover
          return (
    Severity: Minor
    Found in webpack/ForemanColumnExtensions/index.js - About 1 hr to fix

      Function results_build has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Chosen.prototype.results_build = function() {
            var content, data, startTime, _i, _len, _ref;
            startTime = new Date();
            this.parsing = true;
            this.results_data = root.SelectParser.select_to_array(this.form_field);
      Severity: Minor
      Found in app/assets/javascripts/katello/common/chosen.jquery.js - About 1 hr to fix

        Function keyup_checker has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            AbstractChosen.prototype.keyup_checker = function(evt) {
              var stroke, _ref;
              stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
              this.search_field_scale();
              switch (stroke) {
        Severity: Minor
        Found in app/assets/javascripts/katello/common/chosen.jquery.js - About 1 hr to fix

          Function buildRows has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const buildRows = useCallback((results) => {
              const isAddedToFilter = repoId => (!!repositories.filter(repo => repo.id === repoId).length);
              const newRows = [];
              results.forEach((repo) => {
                const {

            Function buildRows has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const buildRows = useCallback((results) => {
                const newRows = [];
                const filterRules = filterResults.find(({ id }) => id === Number(filterId))?.rules || [];
                results.forEach((moduleStreams) => {
                  const {

              Function controller has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      controller: ['$scope', 'translate', function ($scope, translate) {
                          $scope.newBookmark = {};
              
                          $scope.load = function () {
                              BstBookmark.queryPaged({search: 'controller=' + $scope.controllerName}, function (response) {

                Method sync_available_module_stream_associations has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def sync_available_module_stream_associations(new_available_module_streams)
                        new_associated_ids = new_available_module_streams.keys.compact
                        upgradable_streams = self.host_available_module_streams.where(:available_module_stream_id => new_associated_ids)
                        old_associated_ids = self.available_module_stream_ids
                        delete_ids = old_associated_ids - new_associated_ids
                Severity: Minor
                Found in app/models/katello/concerns/host_managed_extensions.rb - About 1 hr to fix

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

                      def index
                        unless @organization || @activation_key
                          fail HttpErrors::NotFound, _("Organization Information not provided.")
                        end
                  
                  
                  Severity: Minor
                  Found in app/controllers/katello/api/v2/subscriptions_controller.rb - About 1 hr to fix

                    Method generate! has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def generate!
                              # For Red Hat repositories or Custom Repositories in the metadata exclusively
                              # Set up a 2 different list of importable root repositories
                              # creatable: repos that are part of the metadata but not in the library.
                              #         They are ready to be created

                      Method destroy_repositories has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def destroy_repositories
                            deletion_authorized_repositories = @repositories.deletable
                            unpromoted_repos = Setting[:delete_repo_across_cv] ? deletion_authorized_repositories : deletion_authorized_repositories.reject { |repo| repo.promoted? && repo.content_views.generated_for_none.exists? }
                            unpromoted_repos_non_last_affected_repo = unpromoted_repos.reject { |repo| repo.filters.any? { |filter| filter.repositories.size == 1 } }
                            messages1 = format_bulk_action_messages(

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

                                  def plan(repository, smart_proxy, args)
                                    file = {:filename => args.dig(:unit_key, :name), :sha256 => args.dig(:unit_key, :checksum) }
                                    content_unit_href = args.dig(:unit_key, :content_unit_id)
                                    docker_tag = (args.dig(:unit_type_id) == "docker_tag")
                        
                        
                        Severity: Minor
                        Found in app/lib/actions/pulp3/orchestration/repository/import_upload.rb - About 1 hr to fix

                          Method run has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  def run # rubocop:disable Metrics/AbcSize
                                    smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id])
                                    api = ::Katello::Pulp3::Api::Core.new(smart_proxy)
                                    export_data = api.export_api.list(input[:exporter_data][:pulp_href]).results.first
                                    output[:exported_file_checksum] = export_data.output_file_info
                          Severity: Minor
                          Found in app/lib/actions/pulp3/content_view_version/create_export_history.rb - About 1 hr to fix

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

                                    this.openHostCollectionsModal = function() {
                                    $uibModal.open({
                                        templateUrl: 'content-hosts/bulk/views/content-hosts-bulk-host-collections-modal.html',
                                        controller: 'ContentHostsBulkHostCollectionsModalController',
                                        size: 'lg',
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 27..36
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 38..47
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 49..58
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 60..69
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 71..80
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 82..91
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 93..102
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 104..113

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

                            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 9 locations. Consider refactoring.
                            Open

                                    this.openPackagesModal = function() {
                                        $uibModal.open({
                                        templateUrl: 'content-hosts/bulk/views/content-hosts-bulk-packages-modal.html',
                                        controller: 'ContentHostsBulkPackagesModalController',
                                        size: 'lg',
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 16..25
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 38..47
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 49..58
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 60..69
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 71..80
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 82..91
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 93..102
                            engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js on lines 104..113

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

                            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