Showing 2,737 of 2,737 total issues
Method lists_by_updates_needed
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.lists_by_updates_needed(organizations)
host_collections_hash = {}
host_collections = HostCollection.where(:organization_id => organizations).readable
# determine the state (critical/warning/ok) for each host collection
- Read upRead up
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 overall_status
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def overall_status
# the overall status of tasks (e.g. associated with a system) are determined by a
# combination of the task state and the status of the unit within the task.
unit_status = true
if (self.result.is_a? Hash) && (self.result.key? :details)
- Read upRead up
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_by_schema_version
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.find_by_schema_version(_key, operator, value)
conditions = ""
if operator == '='
if ["1", "2"].include?(value)
column = if value == "1"
- Read upRead up
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_sortable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.scoped_search_sortable(column, operator, value)
if ['>', '>=', '<', '<='].include?(operator)
conditions = "#{self.table_name}.#{column}_sortable COLLATE \"C\" #{operator} ? COLLATE \"C\""
parameter = Util::Package.sortable_version(value)
return { :conditions => conditions, :parameter => [parameter] }
- Read upRead up
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 set_content_view_environments
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_content_view_environments
content_facet_attributes = params.dig(:host, :content_facet_attributes)
return if content_facet_attributes.blank? || @host&.content_facet.blank? ||
(cve_params[:content_view_id].present? && cve_params[:lifecycle_environment_id].present?)
cves = ::Katello::ContentViewEnvironment.fetch_content_view_environments(
- Read upRead up
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_blob_push_props
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_blob_push_props(path_string = nil)
# path string should follow one of these formats:
# - /v2/{org_label}/{product_label}/{name}/blobs/uploads...
# - /v2/id/{org_id}/{product_id}/{name}/blobs/uploads...
# - /v2/{org_label}/{product_label}/{name}/manifests/...
- Read upRead up
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_repo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_repo(repo_param)
repo_param[:unprotected] = repo_param[:unprotected].nil? ? false : repo_param[:unprotected]
if repo_param[:download_policy].blank? && Katello::RootRepository::CONTENT_ATTRIBUTE_RESTRICTIONS[:download_policy].include?(repo_param[:content_type])
repo_param[:download_policy] = Setting[:default_download_policy]
- Read upRead up
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 safe_render_container_name
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.safe_render_container_name(repository, pattern = nil)
# pattern provided / env pattern provided
# | 00 | 01 | 11 | 10
# ----------------+-----+-----+-----+------
# env exists / 00| 4 | n/a | n/a | 4
- Read upRead up
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_view_environments
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_content_view_environments
environments = []
if params.key?(:environment_id)
environments = [get_content_view_environment("cp_id", params[:environment_id])]
- Read upRead up
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 unregister_host
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def unregister_host(host, options = {})
organization_destroy = options.fetch(:organization_destroy, false)
unregistering = options.fetch(:unregistering, false)
keep_kickstart_repository = options.fetch(:keep_kickstart_repository, false)
- Read upRead up
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 8 (exceeds 5 allowed). Consider refactoring. Open
def index_relation
version_number = params.permit(:version)[:version]
versions = ContentViewVersion.readable
versions = versions.triggered_by(params[:triggered_by_id]) if params[:triggered_by_id]
versions = versions.with_organization_id(params[:organization_id]) if params[:organization_id]
- Read upRead up
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 8 (exceeds 5 allowed). Consider refactoring. Open
def create
repo_params = repository_params
unless RepositoryTypeManager.creatable_by_user?(repo_params[:content_type], false)
msg = _("Invalid params provided - content_type must be one of %s") %
RepositoryTypeManager.creatable_repository_types.keys.sort.join(",")
- Read upRead up
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 status
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def status
overidden_value = enabled_content_override&.computed_value
if overidden_value.nil?
{
status: enabled ? "enabled" : "disabled",
- Read upRead up
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_uploads
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def import_uploads
generate_metadata = ::Foreman::Cast.to_bool(params.fetch(:publish_repository, true))
sync_capsule = ::Foreman::Cast.to_bool(params.fetch(:sync_capsule, true))
async = ::Foreman::Cast.to_bool(params.fetch(:async, false))
if params['uploads'].empty?
- Read upRead up
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_event
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run_event(event)
Katello::Logging.time("katello event handled") do |data|
data[:type] = event.event_type
data[:object_id] = event.object_id
data[:expired] = false
- Read upRead up
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 8 (exceeds 5 allowed). Consider refactoring. Open
def index_relation
return HostAvailableModuleStream.upgradable([@host]) if params[:status] == HostAvailableModuleStream::UPGRADABLE
rel = @host.host_available_module_streams.where(available_module_stream_id: find_available_module_stream_ids)
if params[:sort_by] == 'installed_profiles'
- Read upRead up
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_content_view_environment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_content_view_environment(key, value)
cve = nil
if value
cve = ContentViewEnvironment.where(key => value).first
fail HttpErrors::NotFound, _("Couldn't find environment '%s'") % value unless cve
- Read upRead up
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 poll_for_events
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def poll_for_events
@thread = Thread.new do
@logger.info("Polling Katello Event Queue")
loop do
Rails.application.executor.wrap do
- Read upRead up
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_or_create_import_view
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_or_create_import_view
fail _("Content View label not provided.") if metadata_map.content_view.label.blank?
params = import_content_view_params
return if @metadata_map.syncable_format? && params[:generated_for] != :none
- Read upRead up
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 deliver!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.deliver!(orgs = ::Organization.all)
return unless Setting[:subscription_connection_enabled]
orgs.each do |org|
if cdn_inaccessible?(org) || upstream_inaccessible?(org)
- Read upRead up
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"