Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

Method deb_names_for_job_template has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def deb_names_for_job_template(action:, search:)
        actions = %w(install remove update).freeze
        case action
        when 'install'
          deb_installable = ::Katello::Deb.search_for(search).distinct.pluck(:name)
Severity: Minor
Found in app/models/katello/concerns/host_managed_extensions.rb - About 55 mins 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 last_env_sync_task has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def last_env_sync_task(env)
        last_env_sync_task = sync_tasks.order(ended_at: :desc).detect { |task| task.input.with_indifferent_access.dig(:options, :environment_id) == env.id || task.input.with_indifferent_access.dig(:options, :environment_ids)&.include?(env.id) }

        # env_ids_task_exists checks if any full syncs have run since we started tracking env_ids at time of sync.
        # If yes, return last_env_sync_task which checks for env_id specific sync + full syncs which contain env as part of env_ids
Severity: Minor
Found in app/models/katello/concerns/smart_proxy_extensions.rb - About 55 mins 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 distribution_repositories has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def distribution_repositories(host, content_facet: nil)
        content_facet ||= host.content_facet
        case content_facet
        when ::Katello::Host::ContentFacet
          if content_facet.new_record?
Severity: Minor
Found in app/models/katello/concerns/redhat_extensions.rb - About 55 mins 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 packages_change_description has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def packages_change_description(data, action)
      ret = []

      data ||= {}
      data[:details] ||= {}
Severity: Minor
Found in app/models/katello/task_status.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
Open

      def index_relation
        if @version && params[:available_for] == "content_view_version" && self.respond_to?(:available_for_content_view_version)
          collection = self.available_for_content_view_version(@version)
        else
          collection = resource_class.all
Severity: Minor
Found in app/controllers/katello/concerns/api/v2/repository_content_controller.rb - About 55 mins 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 assign_single_environment has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def assign_single_environment(
      content_view_id: nil, lifecycle_environment_id: nil, environment_id: nil,
      content_view: nil, lifecycle_environment: nil, environment: nil
    )
      lifecycle_environment_id ||= environment_id || lifecycle_environment&.id || environment&.id || self.single_lifecycle_environment&.id
Severity: Minor
Found in app/models/katello/activation_key.rb - About 55 mins 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_destroyable! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_destroyable!(skip_environment_check: false)
      unless organization.being_deleted?
        if !skip_environment_check && in_environment?
          fail _("Cannot delete version while it is in environments: %s") %
                   environments.map(&:name).join(",")
Severity: Minor
Found in app/models/katello/content_view_version.rb - About 55 mins 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 update_guests has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def update_guests(consumer_params)
        if self.hypervisor
          if !consumer_params.try(:[], 'guestIds').empty?
            guest_ids = consumer_params['guestIds'].map do |id|
              case id
Severity: Minor
Found in app/models/katello/host/subscription_facet.rb - About 55 mins 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 update_multiple_taxonomies has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def update_multiple_taxonomies(type)
          if type == :organization
            new_org_id = params.dig(type, 'id')

            if new_org_id
Severity: Minor
Found in app/controllers/katello/concerns/hosts_controller_extensions.rb - About 55 mins 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 change_content_source_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def change_content_source_data
          hosts = params[:search].presence ? ::Host.search_for(params[:search]) : ::Host.where(id: params[:host_ids])
          content_hosts = []
          hosts_without_content = []

Severity: Minor
Found in app/controllers/katello/concerns/hosts_controller_extensions.rb - About 55 mins 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 content_unit_pulp_ids has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def content_unit_pulp_ids(repo, additional_included_errata = [])
      return [] if erratum_rules.blank?

      if filter_by_id?
        errata_ids = erratum_rules.map(&:errata_id)
Severity: Minor
Found in app/models/katello/content_view_erratum_filter.rb - About 55 mins 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 activation_key_params has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def activation_key_params
      key_params = permitted_params.except(:environment_id, :content_view_id,
                      :content_view_environments, :content_view_environment_ids)

      unless params[:purpose_addons].nil?
Severity: Minor
Found in app/controllers/katello/api/v2/activation_keys_controller.rb - About 55 mins 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 find_content has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def find_content
      content_type = params[:content_type]

      if content_type
        RepositoryTypeManager.check_content_matches_repo_type!(@repository, params[:content_type]) if params[:content_type]
Severity: Minor
Found in app/controllers/katello/api/v2/repositories_controller.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def index_relation
      if @product.nil?
        authorized_product_contents = Katello::ProductContent.joins(:product).merge(@product_scope)
        relation = @organization.product_contents.merge(authorized_product_contents).displayable
      else
Severity: Minor
Found in app/controllers/katello/api/v2/repository_sets_controller.rb - About 55 mins 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 save_distribution_references has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def save_distribution_references(hrefs)
        hrefs.each do |href|
          pulp3_distribution_data = api.get_distribution(href)
          path, content_guard_href = pulp3_distribution_data&.base_path, pulp3_distribution_data&.content_guard
          if distribution_reference
Severity: Minor
Found in app/services/katello/pulp3/repository.rb - About 55 mins 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 upload has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def upload
        if @host.nil?
          Rails.logger.warn("Host was not specified; skipping")
          return false
        elsif @host.content_facet.nil? || @host.content_facet.uuid.nil?
Severity: Minor
Found in app/services/katello/host/profiles_uploader.rb - About 55 mins 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 calculate_and_import has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def calculate_and_import
        if self.bound_library_instance_repos.any?
          to_add, to_remove = applicable_differences
          ActiveRecord::Base.transaction do
            insert(to_add) unless to_add.blank?
Severity: Minor
Found in app/services/katello/applicability/applicable_content_helper.rb - About 55 mins 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 finalize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def finalize
          User.as_anonymous_admin do
            content_view = ::Katello::ContentView.find(input[:content_view_id])
            repository = ::Katello::Repository.find(input[:repository_id]) if input[:repository_id]

Severity: Minor
Found in app/lib/actions/katello/foreman/content_update.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(repositories, content_view_version, destination_repository, options = {})
          incremental = options.fetch(:incremental, false)
          content_view = content_view_version.content_view
          filters = incremental ? [] : content_view.filters.applicable(repositories.first)
          rpm_filenames = extract_rpm_filenames(options.fetch(:repos_units, nil), repositories.first.label)
Severity: Minor
Found in app/lib/actions/katello/repository/clone_to_version.rb - About 55 mins 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 invoke_external_task has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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

Severity
Category
Status
Source
Language