Katello/katello

View on GitHub

Showing 2,689 of 2,689 total issues

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

        def generate!
          # This returns a 2 different list of importable products
          # creatable: products that are part of the metadata but not in the library.
          #            They are ready to be created
          # updatable: products that are both in the metadata and library.
Severity: Minor
Found in app/services/katello/pulp3/content_view_version/importable_products.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 fetch_from_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.fetch_from_list
          page_size = Setting[:bulk_load_size]
          page_opts = { "offset" => 0, limit: page_size }
          response = {}

Severity: Minor
Found in app/services/katello/pulp3/api/core.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 custom_sort_results has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def custom_sort_results(unsorted_relation)
      return unsorted_relation unless params[:sort_by] == 'enabled_by_default'
      product_content_finder = ProductContentFinder.wrap_with_overrides(
        product_contents: unsorted_relation,
        overrides: @consumable&.content_overrides,
Severity: Minor
Found in app/controllers/katello/api/v2/repository_sets_controller.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 sync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def sync
      find_environment if params[:environment_id]
      find_content_view if params[:content_view_id]
      find_repository if params[:repository_id]
      skip_metadata_check = ::Foreman::Cast.to_bool(params[:skip_metadata_check])
Severity: Minor
Found in app/controllers/katello/api/v2/capsule_content_controller.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_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_params
      @name_stream_only = ::Foreman::Cast.to_bool(params[:name_stream_only])

      if params[:host_ids]
        @host_ids = params[:host_ids].is_a?(Array) ? params[:host_ids] : params[:host_ids].split(",")
Severity: Minor
Found in app/controllers/katello/api/v2/module_streams_controller.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create
      rule_clazz = ContentViewFilter.rule_class_for(@filter)

      rules = (rule_params[:name] || []).map do |name|
        rule_clazz.create!(rule_params.except(:name).merge(:filter => @filter, name: name))
Severity: Minor
Found in app/controllers/katello/api/v2/content_view_filter_rules_controller.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 setup_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def setup_params
      return unless params[:id]
      params[:content_access_mode_all] = true
      if params[:entity] == :activation_key
        params[:activation_key_id] ||= params[:id]
Severity: Minor
Found in app/controllers/katello/api/v2/repository_sets_controller.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 sort_score has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def sort_score(pc) # sort order for enabled
      score = if pc.enabled_content_override&.value == "1"
                4 # overridden to enabled
              elsif pc.enabled_content_override.nil? && pc.enabled
                3 # enabled
Severity: Minor
Found in app/controllers/katello/api/v2/repository_sets_controller.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 ssl_remote_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def ssl_remote_options
        options = {}
        if root.redhat? && root.cdn_configuration.redhat_cdn?
          options = {
            client_cert: root.product.certificate,
Severity: Minor
Found in app/services/katello/pulp3/repository.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 index_relation_content_view has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def index_relation_content_view(query)
      if params[:content_view_version_id]
        query = query.where(:content_view_version_id => params[:content_view_version_id])
        query = query.archived if ::Foreman::Cast.to_bool params[:archived]
        query = Katello::Repository.where(:id => query.select(:library_instance_id)) if params[:library]
Severity: Minor
Found in app/controllers/katello/api/v2/repositories_controller.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 ensure_metadata_matches_repos_in_library! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def ensure_metadata_matches_repos_in_library!
          bad_repos = @interested_repos.select do |katello_repo|
            metadata_repo = metadata_repo_for_katello_repo(katello_repo)

            next unless metadata_repo
Severity: Minor
Found in app/services/katello/pulp3/content_view_version/import_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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def index
      unless @organization || @activation_key
        fail HttpErrors::NotFound, _("Organization Information not provided.")
      end

Severity: Minor
Found in app/controllers/katello/api/v2/subscriptions_controller.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! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def check!
          if @metadata_map.content_view.blank? && !metadata_map.syncable_format?
            fail _("Content view not provided in the metadata")
          end

Severity: Minor
Found in app/services/katello/pulp3/content_view_version/import_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 change_content_source has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def change_content_source
      hosts = ::Host.where(id: params[:host_ids])
      throw_resource_not_found(name: 'host', id: params[:host_ids]) unless hosts.any?

      lifecycle_environment = KTEnvironment.readable.find(params[:environment_id])
Severity: Minor
Found in app/controllers/katello/api/v2/hosts_bulk_actions_controller.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 build_modules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.build_modules(katello_id, module_stream_list)
        module_stream_attributes = []
        module_stream_list.each do |package_item|
          if package_item[:module]
            module_stream = ::Katello::ModuleStream.where(package_item[:module]).first
Severity: Minor
Found in app/services/katello/pulp3/erratum.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 verify_checksum has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def verify_checksum
      find_capsule(false)
      find_environment if params[:environment_id]
      find_content_view if params[:content_view_id]
      find_repository if params[:repository_id]
Severity: Minor
Found in app/controllers/katello/api/v2/capsule_content_controller.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 copy_content_from_mapping has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def copy_content_from_mapping(repo_id_map, options = {})
          repo_id_map.each do |source_repo_ids, dest_repo_map|
            filters = [ContentViewErratumFilter, ContentViewPackageGroupFilter, ContentViewPackageFilter].collect do |filter_class|
              filter_class.where(:id => dest_repo_map[:filter_ids])
            end
Severity: Minor
Found in app/services/katello/pulp3/repository/yum.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 sync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def sync
      fail HttpErrors::BadRequest, _("attempted to sync a non-library repository.") unless @repository.library_instance?
      sync_options = {
        :skip_metadata_check => ::Foreman::Cast.to_bool(params[:skip_metadata_check]),
        :validate_contents => ::Foreman::Cast.to_bool(params[:validate_contents]),
Severity: Minor
Found in app/controllers/katello/api/v2/repositories_controller.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 update_content_overrides has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def update_content_overrides(id, content_overrides)
            attrs_to_delete = []
            attrs_to_update = []
            content_overrides.each do |content_override|
              if content_override[:value]
Severity: Minor
Found in app/lib/katello/resources/candlepin/activation_key.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
          repository = ::Katello::Repository.find(input[:repository_id])
          if input[:sync_capsule]
            ForemanTasks.async_task(Katello::Repository::CapsuleSync, repository) if Setting[:foreman_proxy_content_auto_sync]
          end
Severity: Minor
Found in app/lib/actions/katello/repository/import_upload.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