Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

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

      pool_id_quantities = params.require(:subscriptions).inject({}) do |new_hash, subscription|
        new_hash[subscription['id']] ||= PoolWithQuantities.new(Pool.with_identifier(subscription['id']))
        new_hash[subscription['id']].quantities << subscription['quantity']
        new_hash
Severity: Minor
Found in app/controllers/katello/api/v2/host_subscriptions_controller.rb and 1 other location - About 30 mins to fix
app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb on lines 117..120

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

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

  module Authorization::ContentCredential
    extend ActiveSupport::Concern

    include Authorizable

Severity: Minor
Found in app/models/katello/authorization/content_credential.rb and 1 other location - About 30 mins to fix
app/models/katello/authorization/alternate_content_source.rb on lines 2..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 33.

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 too many return statements within this function.
Open

  return (
    <Table
      ouiaId="Content-View-table"
      aria-label="Content View Table"
      className="katello-pf4-table"
Severity: Major
Found in webpack/components/Table/MainTable.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          } return (repo1.arch > repo2.arch) ? -1 : 1;

      Avoid too many return statements within this function.
      Open

              } return (repo1Major > repo2Major) ? -1 : 1;

        Avoid too many return statements within this function.
        Open

            return (
              <TableComposable
                ouiaId="content-view-table-composable"
                aria-label="Content View Table"
                className="katello-pf4-table"
        Severity: Major
        Found in webpack/components/Table/MainTable.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return (
                <Grid id="redhatRepositoriesPage" bsClass="container-fluid">
                  <h1>{__('Red Hat Repositories')}</h1>
                  <Row className="toolbar-pf">
                    <Col sm={12}>
          Severity: Major
          Found in webpack/scenes/RedHatRepositories/RedHatRepositoriesPage.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return __('Select a content view');
            Severity: Major
            Found in webpack/scenes/ContentViews/components/ContentViewSelect/helpers.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return false;
              Severity: Major
              Found in webpack/scenes/ContentViews/components/ContentViewSelect/helpers.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  if (cvSelectOptions.length === 0) return true;
                Severity: Major
                Found in webpack/scenes/ContentViews/components/ContentViewSelect/helpers.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return 'All versions';
                  Severity: Major
                  Found in webpack/scenes/ContentViews/Details/Filters/CVDebFilterContent.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return __('Incremental update');
                    Severity: Major
                    Found in webpack/scenes/ContentViews/Details/Histories/ContentViewHistories.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return (<EmptyStateMessage
                            title={emptySearchTitle}
                            body={emptySearchBody}
                            search
                            {...clearSearchProps}
                      Severity: Major
                      Found in webpack/components/Table/MainTable.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return 'All versions';
                        Severity: Major
                        Found in webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                            return <EmptyStateIcon icon={CubeIcon} />;
                          Severity: Major
                          Found in webpack/components/Table/EmptyStateMessage.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return '';
                            Severity: Major
                            Found in webpack/scenes/ContentViews/Details/Histories/ContentViewHistories.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                if (cvSelectOptions.length === 0) return __('No content views available');
                              Severity: Major
                              Found in webpack/scenes/ContentViews/components/ContentViewSelect/helpers.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      if (parsedQuantity <= 0) return aboveZeroMsg;

                                  Avoid too many return statements within this function.
                                  Open

                                      return state.merge({
                                        error: action.payload.message,
                                        loading: false,
                                      });
                                  Severity: Major
                                  Found in webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                        return state.merge({
                                          error: action.payload.message,
                                          loading: false,
                                        });
                                    Severity: Major
                                    Found in webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language