Katello/katello

View on GitHub

Showing 2,689 of 2,689 total issues

Method _check_single_date_range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def _check_single_date_range(record)
        if record.start_date || record.end_date || !record.types.empty?
          if !record.filter.erratum_rules.empty? &&
             !record.filter.erratum_rules.any? { |rule| rule.id == record.id }
            invalid_parameters = _("May not add a type or date range rule to a filter that has existing rules.")
Severity: Minor
Found in app/lib/katello/validators/content_view_erratum_filter_rule_validator.rb - About 25 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 handle_acs_product_removal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def handle_acs_product_removal(repository)
          # Remove products from ACS's that contain no repositories which both
          # match the ACS content type and have a non-nil URL
          product = repository.product
          repo_content_types = Set.new
Severity: Minor
Found in app/lib/actions/katello/repository/destroy.rb - About 25 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 create_missing_hosts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def create_missing_hosts
          # remaining hypervisors
          new_hypervisors = {}
          @hypervisors.each do |hypervisor|
            next if @hosts.key?(hypervisor[:uuid])
Severity: Minor
Found in app/lib/actions/katello/host/hypervisors_update.rb - About 25 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 extract_epoch_version_release has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def extract_epoch_version_release(evr)
        parsed = Package.parse_evr(evr)
        self.epoch = parsed[:epoch].to_i # nil or blank becomes 0
        v = parsed[:version]
        self.version = (v.nil? || v.blank?) ? '' : Package.sortable_version(v)
Severity: Minor
Found in app/lib/katello/util/package_filter.rb - About 25 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 filter_errata_by_pulp_href has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def filter_errata_by_pulp_href(errata, content_pulp_hrefs, source_repo_rpm_filenames, source_repo_module_stream_specs)
        return [] if content_pulp_hrefs.empty?

        source_repo_rpm_filenames = source_repo_rpm_filenames.map { |rpm| File.basename(rpm) }
        rpm_filenames = Katello::Rpm.where(:pulp_id => content_pulp_hrefs).map { |rpm| File.basename(rpm.filename) }
Severity: Minor
Found in app/lib/katello/util/errata.rb - About 25 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 from_task has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.from_task(task)
        if %w(error canceled).include?(task[:state])
          message = if task[:exception]
                      Array(task[:exception]).join('; ')
                    elsif task[:error]
Severity: Minor
Found in app/lib/katello/errors.rb - About 25 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_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def validate_content(old_version, content, components)
          if old_version.content_view.composite?
            fail(_("Cannot specify content for composite views")) unless content.empty?
            validate_components(old_version, components)
          else
Severity: Minor
Found in app/lib/actions/katello/content_view_version/incremental_update.rb - About 25 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 handle_acs_product_removal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def handle_acs_product_removal(repository)
          # Remove products from ACS's that contain no repositories which both
          # match the ACS content type and have a non-nil URL
          product = repository.product
          repo_content_types = Set.new
Severity: Minor
Found in app/lib/actions/katello/repository/update.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(repository)
          sequence do
            plan_action(Katello::Repository::MetadataGenerate, repository)
            concurrence do
              (::SmartProxy.unscoped.with_repo(repository).select { |sp| sp.authorized?(:manage_capsule_content) && sp.authorized?(:view_capsule_content) })&.each do |capsule|
Severity: Minor
Found in app/lib/actions/katello/repository/update_metadata_sync.rb - About 25 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 clauses_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def clauses_for(list_type)
        # fetch the applicable content type filters - fetch_filters implemented
        # by subclasses. idea is those content type  filter classes would
        # implement whitelist, blacklist scopes.
        filters = fetch_filters.send(list_type).where(:id => @filters) # abstract
Severity: Minor
Found in app/lib/katello/util/filter_clause_generator.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(extended_repo_mapping, options)
          generate_metadata = options.fetch(:generate_metadata, true)
          copy_contents = options.fetch(:copy_contents, true)
          solve_dependencies = options.fetch(:solve_dependencies, false)

Severity: Minor
Found in app/lib/actions/katello/repository/multi_clone_contents.rb - About 25 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 wrap_with_overrides has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.wrap_with_overrides(product_contents:, overrides:, status: nil, repository_type: nil)
      pc_with_overrides = product_contents.map { |pc| ProductContentPresenter.new(pc, overrides) }
      if status
        pc_with_overrides.keep_if do |pc|
          if status == "overridden"
Severity: Minor
Found in app/services/katello/product_content_finder.rb - About 25 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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def run
          ::Host.unscoped.find_each do |host|
            host.content_facet.update_errata_status if host.content_facet.try(:uuid)
          rescue StandardError => error
            output[:errors] ||= []
Severity: Minor
Found in app/lib/actions/katello/host/recalculate_errata_status.rb - About 25 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 rescue_from_wrapped_error has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def rescue_from_wrapped_error(exception)
          logger.error "*** ERROR: #{exception.message} (#{exception.status_code}) ***"
          logger.error "REQUEST URL: #{request.fullpath}"
          logger.error pp_exception(exception.original.nil? ? exception : exception.original)

Severity: Minor
Found in app/lib/katello/api/v2/error_handling.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

        def finalize
          version = ::Katello::ContentViewVersion.find(input[:new_content_view_version_id])
          version.update_content_counts!
          version.add_applied_filters!
          generate_description(version, output[:added_units]) if version.description.blank?
Severity: Minor
Found in app/lib/actions/katello/content_view_version/incremental_update.rb - About 25 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 check_cv_capsule_environments! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def check_cv_capsule_environments!(smart_proxy, content_view, environment)
          cv_environments = content_view&.versions&.collect(&:environments)&.flatten
          if cv_environments.present?
            if environment.present? && !(cv_environments.pluck(:id).include? environment.id)
              fail _("Content view '%{content_view}' is not attached to the environment.") % {content_view: content_view.name}
Severity: Minor
Found in app/lib/actions/katello/capsule_content/verify_checksum.rb - About 25 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 version_for_publish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def version_for_publish(content_view, options)
          if options[:minor] && options[:major]
            if options[:override_components]
              content_view.create_new_version(options[:major], options[:minor], options[:override_components])
            else
Severity: Minor
Found in app/lib/actions/katello/content_view/publish.rb - About 25 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 import_package_profile_for_host has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.import_package_profile_for_host(host_id, profile)
        host = ::Host.find_by(:id => host_id)
        if host.nil?
          Rails.logger.warn("Host with ID %s not found; continuing" % host_id)
        elsif host.content_facet.nil? || host.content_facet.uuid.nil?
Severity: Minor
Found in app/services/katello/host/package_profile_uploader.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(repos, options = {})
          sequence do
            plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::MetadataGenerate, repos.in_default_view, options) if repos.in_default_view.any?
            plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::MetadataGenerate, repos.archived, options) if repos.archived.any?
            plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::MetadataGenerate, repos.in_published_environments, options) if repos.in_published_environments.any?
Severity: Minor
Found in app/lib/actions/katello/repository/bulk_metadata_generate.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(host, pools_with_quantities_params)
          action_subject(host)

          subscription_facet = host.subscription_facet
          fail _("Register host '%s' before attaching subscriptions") % host.name unless subscription_facet
Severity: Minor
Found in app/lib/actions/katello/host/attach_subscriptions.rb - About 25 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