Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

Method multi_copy_units has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def multi_copy_units(repo_id_map, _dependency_solving)
          tasks = []

          if repo_id_map.values.pluck(:content_unit_hrefs).flatten.any?
            data = PulpDebClient::Copy.new
Severity: Minor
Found in app/services/katello/pulp3/repository/apt.rb - About 1 hr to fix

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

Method add_content has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def add_content(content_unit_href, remove_all_units = false)
        content_unit_href = [content_unit_href] unless content_unit_href.is_a?(Array)
        if remove_all_units
          api.repositories_api.modify(repository_reference.repository_href, remove_content_units: ['*'])
          api.repositories_api.modify(repository_reference.repository_href, add_content_units: content_unit_href)
Severity: Minor
Found in app/services/katello/pulp3/repository.rb - About 1 hr to fix

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

Method available_incremental_updates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def available_incremental_updates
      fail HttpErrors::BadRequest, _("errata_ids is a required parameter") if params[:errata_ids].empty?
      version_environments = {}
      content_facets = Katello::Host::ContentFacet.with_non_installable_errata(@errata, @hosts)

Severity: Minor
Found in app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb - About 1 hr to fix

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

Method refresh_distributions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def refresh_distributions(_options = {})
        path = repo_service.relative_path
        dist_params = {}
        if repo_service.repo.repository_type.pulp3_skip_publication
          dist_params[:repository_version] = version_href
Severity: Minor
Found in app/services/katello/pulp3/repository_mirror.rb - About 1 hr to fix

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

Method index_relation_environment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def index_relation_environment(query)
      if params[:environment_id] && !params[:library]
        query = query.where(:environment_id => params[:environment_id])
      elsif params[:environment_id] && params[:library]
        instances = query.where(:environment_id => params[:environment_id])
Severity: Minor
Found in app/controllers/katello/api/v2/repositories_controller.rb - About 1 hr to fix

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

Method index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def index
      history = ContentViewVersionImportHistory.readable
      history = history.where(:id => params[:id]) unless params[:id].blank?
      history = history.where(:content_view_version_id => params[:content_view_version_id]) unless params[:content_view_version_id].blank?
      history = history.with_organization_id(params[:organization_id]) unless params[:organization_id].blank?
Severity: Minor
Found in app/controllers/katello/api/v2/content_imports_controller.rb - About 1 hr to fix

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

Method create_upload has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def create_upload(size = 0, checksum = nil, content_type = nil, repository = nil)
          content_unit_href = nil
          content_type = ::Katello::RepositoryTypeManager.find_content_type(content_type)

          if checksum && !content_type.repository_import_on_upload
Severity: Minor
Found in app/services/katello/pulp3/content.rb - About 1 hr to fix

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

Method index_relation has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def index_relation
      if @host
        query = @host.host_collections

        if params[:available_for] == "host"
Severity: Minor
Found in app/controllers/katello/api/v2/host_collections_controller.rb - About 1 hr to fix

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

Method plan has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(cv_env, options = {})
          skip_repo_destroy = options.fetch(:skip_repo_destroy, false)
          organization_destroy = options.fetch(:organization_destroy, false)
          content_view = cv_env.content_view
          environment = cv_env.environment
Severity: Minor
Found in app/lib/actions/katello/content_view_environment/destroy.rb - About 1 hr to fix

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

Method validate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def validate(facet)
        return unless facet.kickstart_repository_id
        if facet.content_source.blank? && facet.hostgroup.content_source.blank?
          prop = :content_source
          msg = _("Please select a content source before assigning a kickstart repository")

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

Method filter_by_type has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def filter_by_type(errata_list, filter_type)
        filtered_list = []

        if filter_type != "All"
          pulp_filter_type = get_pulp_filter_type(filter_type)
Severity: Minor
Found in app/lib/katello/util/errata.rb - About 1 hr to fix

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

Method pulp3_repo_mapping has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def pulp3_repo_mapping(repo_mapping, old_version)
          pulp3_repo_mapping = {}
          repo_mapping.each do |source_repos, dest_repo|
            old_version_repo = old_version.repositories.archived.find_by(root_id: dest_repo.root_id)

Severity: Minor
Found in app/lib/actions/katello/content_view_version/incremental_update.rb - About 1 hr to fix

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

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

  render() {
    const { services, status } = this.props;
    const isLoading = status === 'PENDING';

    return (
Severity: Minor
Found in webpack/components/extensions/about/SystemStatuses.js - About 1 hr to fix

    Function processStyle has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function processStyle(styleString) {
        if (styleString in processStyleCache) {
          return processStyleCache[styleString];
        }
    
    
    Severity: Minor
    Found in app/assets/javascripts/katello/html5/excanvas.js - About 1 hr to fix

      Function removeProducts has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function edit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                $scope.edit = function () {
                    var options;
        
                    if ($scope.readonly !== true) {
                        $scope.editMode = true;

          Function DebController has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function DebController($scope, Deb, Host, CurrentOrganization, ApiErrorHandler, newHostDetailsUI) {
                  $scope.panel = {
                      error: false,
                      loading: true
                  };

            Method copy_content_chunked has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def copy_content_chunked(data)
                      tasks = []
                      # Don't chunk if there aren't enough content units
                      if data.config.sum { |repo_config| repo_config[:content].size } <= UNIT_LIMIT
                        return api.copy_api.copy_content(data)
            Severity: Minor
            Found in app/services/katello/pulp3/repository/apt.rb - About 1 hr to fix

              Method render_bad_parameters has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def render_bad_parameters(*args)
                    default_message = if request.xhr?
                                        _('Invalid parameters sent in the request for this operation. Please contact a system administrator.')
                                      else
                                        _('Invalid parameters sent. You may have mistyped the address. If you continue having trouble with this, please contact an Administrator.')
              Severity: Minor
              Found in app/controllers/katello/application_controller.rb - About 1 hr to fix

                Method find_duplicate_unit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def self.find_duplicate_unit(repository, unit_type_id, file, checksum)
                        filter_label = :sha256
                        path_label = :relative_path
                        if unit_type_id == 'ostree_ref'
                          filter_label = :checksum
                Severity: Minor
                Found in app/services/katello/pulp3/pulp_content_unit.rb - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language