Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

Method remote_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def remote_options
          deb_remote_options = {
            policy: root.download_policy,
            distributions: root.deb_releases
          }
Severity: Minor
Found in app/services/katello/pulp3/repository/apt.rb - About 35 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_publish_params! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_publish_params!
      if params[:repos_units].present? && @content_view.composite?
        fail HttpErrors::BadRequest, _("Directly setting package lists on composite content views is not allowed. Please " \
                                     "update the components, then re-publish the composite.")
      end
Severity: Minor
Found in app/controllers/katello/api/v2/content_views_controller.rb - About 35 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_repository_associations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sync_repository_associations(assocication_tracker, additive: false)
      unless additive
        ActiveRecord::Base.connection.uncached do
          repo_associations_to_destroy = @model_class.repository_association_class.where(repository_id: @repository.id).where.
            not(@model_class.unit_id_field => assocication_tracker.unit_ids)
Severity: Minor
Found in app/services/katello/content_unit_indexer.rb - About 35 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_vrea has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.build_vrea(package, include_zero_epoch = true)
        vrea =  [package[:version], package[:release]].compact.join('-')
        vrea = vrea + '.' + package[:arch] unless package[:arch].nil?
        vrea = vrea + '.' + package[:suffix] unless package[:suffix].nil?
        if !package[:epoch].nil? && (package[:epoch].to_i != 0 || include_zero_epoch)
Severity: Minor
Found in app/lib/katello/util/package.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

        def run
          ::User.current = ::User.anonymous_admin
          repo = ::Katello::Repository.find(input[:repo])
          input[:new_associated_errata] = repo.repository_errata.pluck(:erratum_id).uniq.sort.reverse - input[:associated_errata_before_syncing]

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

      def validate(record)
        # need to verify, that gpg_key is of GpgKey.content type "gpg_key" and
        # ssl_ca_cert, ssl_client_cert, ssl_client_key of GpgKey.content type "cert"

        if !record.gpg_key.blank? && record.gpg_key.content_type != "gpg_key"
Severity: Minor
Found in app/lib/katello/validators/gpg_key_content_type_validator.rb - About 35 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 parse_parameters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def parse_parameters(field_value)
          seen_rel = false
          has_next_rel = false
          has_anchor = false
          until field_value.empty?
Severity: Minor
Found in app/lib/katello/resources/discovery/container.rb - About 35 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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def get(path, _headers = {})
          net = http_downloader
          path = File.join(@uri.request_uri, path)
          used_url = File.join("#{@uri.scheme}://#{@uri.host}:#{@uri.port}", path)
          Rails.logger.info "CDN: Requesting path #{used_url}"
Severity: Minor
Found in app/lib/katello/resources/cdn.rb - About 35 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 add_content has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def add_content(content_unit_href)
          content_unit_href = [content_unit_href] unless content_unit_href.is_a?(Array)
          api.repositories_api.add(repository_reference.repository_href, content_units: content_unit_href)
        rescue api.client_module::ApiError => e
          if e.message.include? 'Could not find the following content units'
Severity: Minor
Found in app/services/katello/pulp3/repository/docker.rb - About 35 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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private def update_content(content, prod_content_json)
      attrs_to_update = {}
      new_name = prod_content_json[:content][:name]
      attrs_to_update[:name] = new_name if content.name != new_name

Severity: Minor
Found in app/services/katello/product_content_importer.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(source_repositories, new_repository, options)
          filters = options.fetch(:filters, nil)
          rpm_filenames = options.fetch(:rpm_filenames, nil)
          generate_metadata = options.fetch(:generate_metadata, true)
          copy_contents = options.fetch(:copy_contents, true)
Severity: Minor
Found in app/lib/actions/katello/repository/clone_contents.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(repository, files, content_type = nil, options = {})
          action_subject(repository)
          repository.check_ready_to_act!
          repository.clear_smart_proxy_sync_histories
          tmp_files = prepare_tmp_files(files)
Severity: Minor
Found in app/lib/actions/katello/repository/upload_files.rb - About 35 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_length has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.validate_length(record, attribute, value, max_length = 128, min_length = 1)
        if value
          record.errors[attribute] << N_("cannot contain more than %s characters") % max_length unless value.length <= max_length
          record.errors[attribute] << N_("must contain at least %s character") % min_length unless value.length >= min_length
        end
Severity: Minor
Found in app/lib/katello/validators/katello_label_format_validator.rb - About 35 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 humanized_content has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def humanized_content
            humanized_lines = []

            action.output[:changed_content].each do |output|
              cvv = ::Katello::ContentViewVersion.find_by(:id => output[:content_view_version][:id])

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 parse_dependencies has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.parse_dependencies(dependencies)
        # dependencies is either 'requires' or 'provides' metadata attribute of rpm package in pulp
        results = []
        flags = {'GT' => '>', 'LT' => '<', 'EQ' => '=', 'GE' => '>=', 'LE' => '<='}

Severity: Minor
Found in app/lib/katello/util/package.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

          def run
            error = false
            input[:host_ids].each do |host_id|
              content_facet = ::Katello::Host::ContentFacet.find_by_host_id(host_id)
              if content_facet.present?
Severity: Minor
Found in app/lib/actions/katello/applicability/hosts/bulk_generate.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

        def plan(pools = [])
          fail _("No pools were provided.") if pools.blank?
          fail _("Current organization is not set.") unless ::Organization.current

          sequence do
Severity: Minor
Found in app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb - About 35 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 respond_with_template_collection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def respond_with_template_collection(action, resource_name, options = {})
          options[:layout] ||= "collection"
          options[:root_name] = params[:root_name] || "results"
          respond_with_template(action, resource_name, options) do
            @collection = options[:collection] unless options[:collection].nil?
Severity: Minor
Found in app/lib/katello/api/v2/rendering.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

        def invoke_external_task
          tasks = []
          content_view = ::Katello::ContentView.find(input[:content_view_id])
          to_delete = content_view.repository_references.select do |repository_reference|
            repo = repository_reference.root_repository.library_instance
Severity: Minor
Found in app/lib/actions/pulp3/content_view/delete_repository_references.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

        def invoke_external_task
          repo = ::Katello::Repository.find(input[:repository_id])
          repo_backend_service = repo.backend_service(smart_proxy)

          if input[:save_artifact_output][:pulp_tasks]&.any?
Severity: Minor
Found in app/lib/actions/pulp3/repository/import_upload.rb - About 35 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