Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

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

        def cancel_repo_discovery
          discovery = latest_repo_discovery
          if discovery
            discovery.execution_plan.steps.each_pair do |_num, step|
              if step.cancellable? && step.is_a?(Dynflow::ExecutionPlan::Steps::RunStep)
Severity: Minor
Found in app/models/katello/concerns/organization_extensions.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 to_label has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def to_label(_options = {})
      case status
      when NEEDED_SECURITY_ERRATA
        errata_status_installable ? N_("Security errata installable") : N_("Security errata applicable")
      when NEEDED_ERRATA
Severity: Minor
Found in app/models/katello/errata_status.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 generate_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_info
      self.name ||= environment.name

      if default_environment?
        self.label ||= environment.label
Severity: Minor
Found in app/models/katello/content_view_environment.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 to_label has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.to_label(status, eos_date: nil, maintenance_support_end_date: nil)
      case status
      when FULL_SUPPORT
        N_('Full support')
      when MAINTENANCE_SUPPORT
Severity: Minor
Found in app/models/katello/rhel_lifecycle_status.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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def create
          if taxonomy_class == Organization
            begin
              @taxonomy = Organization.new(resource_params)
              ::Katello::OrganizationCreator.new(@taxonomy).create!
Severity: Minor
Found in app/controllers/katello/concerns/organizations_controller_extensions.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 assign_single_environment has a Cognitive Complexity of 7 (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/host/content_facet.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 authorize_system_environments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def authorize_system_environments(view, options)
      system_environment_id = options[:system_environment_id]
      if system_environment_id
        sys_env = KTEnvironment.where(:organization_id => view.organization,
                                      :id => system_environment_id).first

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

    def humanize_parameters
      humanized_parameters = []
      if (packages = self.parameters[:packages])
        humanized_parameters.concat(packages)
      end
Severity: Minor
Found in app/models/katello/task_status.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 full_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def full_path(smart_proxy = nil, force_http = false)
      pulp_uri = URI.parse(smart_proxy ? smart_proxy.url : ::SmartProxy.pulp_primary.url)
      scheme = force_http ? 'http' : 'https'
      if docker?
        "#{pulp_uri.host.downcase}/#{container_repository_name}"
Severity: Minor
Found in app/models/katello/repository.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 ensure_valid_os_versions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def ensure_valid_os_versions
      return if os_versions.empty?
      # os_versions here translate to candlepin as 'required tags'.
      # A host must provide ALL required tags in order for the repo to be enabled.
      # So os_versions such as ['rhel-7', 'rhel-8'] is not allowed, since the repo would always be disabled.
Severity: Minor
Found in app/models/katello/root_repository.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 find_authorized_katello_resource has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def find_authorized_katello_resource
        found_entity = nil
        ::Foreman::AccessControl.permissions_for_controller_action(path_to_authenticate).each do |permission|
          next unless found_entity.blank?
          finder_scope = permission&.finder_scope
Severity: Minor
Found in app/controllers/katello/concerns/api/v2/authorization.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 target_repository has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def target_repository
      fail _("This is not a linked repository") if primary?
      return nil if self.archived_instance.nil?

      #this is an environment repo, and the archived_instance is a primary (not always true with composite)
Severity: Minor
Found in app/models/katello/repository.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 ensure_valid_upstream_authorization has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def ensure_valid_upstream_authorization
      # Make sure that the upstream_username / upstream_password is really unset
      # in case if the string is maybe just ""
      if self.upstream_username.blank? && self.upstream_password.blank?
        self.upstream_username = nil
Severity: Minor
Found in app/models/katello/root_repository.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 null_safe_get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def null_safe_get(hash, default, params)
      # Base case .. if we are down to the last param
      # lets actually try and find the value
      if params.size == 1
        begin
Severity: Minor
Found in app/models/katello/hash_util.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 authorize_system_content_view has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def authorize_system_content_view(view, options)
      system_content_view_id = options[:system_content_view_id]
      if system_content_view_id
        sys_content_view = ContentView.where(:organization_id => view.organization,
                                             :id => system_content_view_id).first

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

      def last_sync
        sync_times = []
        self.products.each do |prod|
          break unless prod.respond_to?(:last_sync)
          sync = prod.last_sync
Severity: Minor
Found in app/models/katello/glue/provider.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 scoped_search_evr_equal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.scoped_search_evr_equal(operator, value)
      joiner = (operator == '=' ? 'AND' : 'OR')
      evr = Util::Package.parse_evr(value)
      (e, v, r) = [evr[:epoch], evr[:version], evr[:release]]
      e = e.to_i # nil or blank becomes 0
Severity: Minor
Found in app/models/katello/rpm.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 to_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def to_status(_options = {})
      errata = if errata_status_installable
                 host.content_facet.try(:installable_errata)
               else
                 host.content_facet.try(:applicable_errata)
Severity: Minor
Found in app/models/katello/errata_status.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 ensure_valid_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def ensure_valid_attributes
      if !(content_view.present? || content_view_version.present?)
        errors.add(:base, _("Either set the content view with the latest flag or set the content view version"))
      elsif !composite_content_view.composite?
        errors.add(:base, _("Cannot associate a component to a non composite content view"))
Severity: Minor
Found in app/models/katello/content_view_component.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 populate_fields_from_facts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.populate_fields_from_facts(host, parser, _type, _source_proxy)
        has_convert2rhel = parser.facts.key?('conversions.env.CONVERT2RHEL_THROUGH_FOREMAN')
        return unless host.subscription_facet || has_convert2rhel
        # Add in custom convert2rhel fact if system was converted using convert2rhel through Katello
        # We want the value nil unless the custom fact is present otherwise we get a 0 in the database which if debugging
Severity: Minor
Found in app/models/katello/host/subscription_facet.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