Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

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

UnsavedChangesDialog.propTypes = {
  show: PropTypes.bool.isRequired,
  cancelEdit: PropTypes.func.isRequired,
  showCancelConfirm: PropTypes.func.isRequired,
};
webpack/components/Errata/index.js on lines 102..106
webpack/scenes/Content/Details/ContentInfo.js on lines 56..60
webpack/scenes/Content/Details/ContentRepositories.js on lines 76..80
webpack/scenes/ContentViews/expansions/RelatedContentViewComponentsModal.js on lines 104..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 51.

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

ErrataSummary.propTypes = {
  type: PropTypes.string.isRequired,
  count: PropTypes.number.isRequired,
  errataCategory: PropTypes.string.isRequired,
};
Severity: Major
Found in webpack/components/Errata/index.js and 4 other locations - About 50 mins to fix
webpack/scenes/Content/Details/ContentInfo.js on lines 56..60
webpack/scenes/Content/Details/ContentRepositories.js on lines 76..80
webpack/scenes/ContentViews/expansions/RelatedContentViewComponentsModal.js on lines 104..108
webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/UnsavedChangesDialog.js on lines 20..24

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

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 {
    selectOne, isSelected, isSelectable: _isSelectable,
    selectedCount, selectionSet, ...selectionSetVars
  } = useSelectionSet({
    results,
Severity: Minor
Found in webpack/scenes/AlternateContentSources/MainTable/ACSTable.js and 1 other location - About 50 mins to fix
webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js on lines 72..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 51.

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

              <Popover
                appendTo={() => document.body}
                aria-label="activationKeys-popover"
                position={PopoverPosition.top}
                bodyContent={
webpack/scenes/ContentViews/Details/Versions/BulkDelete/Steps/ReassignHosts.js on lines 160..181

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

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

            }, function (response) {
                Notification.setErrorMessage(response.data.displayMessage);
                $scope.isAdding = false;
                $scope.nutupane.refresh();
            });
engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-add-subscriptions.controller.js on lines 61..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 51.

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

export const getHostRemovableHostCollections = params => get({
  type: API_OPERATIONS.GET,
  key: REMOVABLE_HOST_COLLECTIONS_KEY,
  url: api.getApiUrl('/host_collections'),
  params,
webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsActions.js on lines 7..12

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

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

              <Popover
                appendTo={() => document.body}
                aria-label="contentHost-prefer-portions-popover"
                position={PopoverPosition.top}
                bodyContent={
webpack/scenes/ContentViews/Details/Versions/BulkDelete/Steps/ReassignActivationKeys.js on lines 142..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 51.

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

export const getHostAvailableHostCollections = params => get({
  type: API_OPERATIONS.GET,
  key: AVAILABLE_HOST_COLLECTIONS_KEY,
  url: api.getApiUrl('/host_collections?available_for=host'),
  params,
webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsActions.js on lines 14..19

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

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

            }, function (response) {
                Notification.setErrorMessage(response.data.displayMessage);
                $scope.isAdding = false;
                $scope.contentNutupane.refresh();
            });
engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-add-subscriptions.controller.js on lines 73..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 51.

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 fetch_lifecycle_environment(host_or_hostgroup, options = {})
      return host_or_hostgroup.single_lifecycle_environment if host_or_hostgroup.try(:single_lifecycle_environment)
      return host_or_hostgroup.lifecycle_environment if host_or_hostgroup.try(:lifecycle_environment)
      if host_or_hostgroup.is_a?(::Hostgroup) && host_or_hostgroup.content_facet.present?
        # to handle cloned hostgroups that are new records
Severity: Minor
Found in app/helpers/katello/hosts_and_hostgroups_helper.rb and 1 other location - About 45 mins to fix
app/helpers/katello/hosts_and_hostgroups_helper.rb on lines 99..107

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

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 index_relation
      packages = @host.installed_packages
      upgradable_packages = ::Katello::Rpm.installable_for_hosts([@host]).select(:name)
      if params[:status].present?
        packages = case params[:status]
Severity: Minor
Found in app/controllers/katello/api/v2/host_packages_controller.rb and 1 other location - About 45 mins to fix
app/controllers/katello/api/v2/host_debs_controller.rb on lines 24..33

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

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 index_relation
      packages = @host.installed_debs
      upgradable_packages = ::Katello::Deb.installable_for_hosts([@host]).select(:name)
      if params[:status].present?
        packages = case params[:status]
Severity: Minor
Found in app/controllers/katello/api/v2/host_debs_controller.rb and 1 other location - About 45 mins to fix
app/controllers/katello/api/v2/host_packages_controller.rb on lines 52..61

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

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 fetch_content_view(host_or_hostgroup, options = {})
      return host_or_hostgroup.single_content_view if host_or_hostgroup.try(:single_content_view)
      return host_or_hostgroup.content_view if host_or_hostgroup.try(:content_view)
      if host_or_hostgroup.is_a?(::Hostgroup) && host_or_hostgroup.content_facet.present?
        # to handle cloned hostgroups that are new records
Severity: Minor
Found in app/helpers/katello/hosts_and_hostgroups_helper.rb and 1 other location - About 45 mins to fix
app/helpers/katello/hosts_and_hostgroups_helper.rb on lines 88..96

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

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

Avoid deeply nested control flow statements.
Open

              if ($("#" + result_id).html !== text) {
                $("#" + result_id).html(text);
              }
Severity: Major
Found in app/assets/javascripts/katello/common/chosen.jquery.js - About 45 mins to fix

    Function transform has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) {
    Severity: Minor
    Found in app/assets/javascripts/katello/html5/excanvas.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if (parts.length) {
                      for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
                        part = parts[_j];
                        if (regex.test(part)) {
                          found = true;
      Severity: Major
      Found in app/assets/javascripts/katello/common/chosen.jquery.js - About 45 mins to fix

        Function arc has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          contextPrototype.arc = function(aX, aY, aRadius,
                                          aStartAngle, aEndAngle, aClockwise) {
        Severity: Minor
        Found in app/assets/javascripts/katello/html5/excanvas.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
                          this.result_clear_highlight();
                        }
          Severity: Major
          Found in app/assets/javascripts/katello/common/chosen.jquery.js - About 45 mins to fix

            Function setTransform has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) {
            Severity: Minor
            Found in app/assets/javascripts/katello/html5/excanvas.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                            if (option.group_array_index != null) {
                              $("#" + this.results_data[option.group_array_index].dom_id).show();
                            }
              Severity: Major
              Found in app/assets/javascripts/katello/common/chosen.jquery.js - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language