Showing 2,737 of 2,737 total issues
Method import_products_from_cp
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def import_products_from_cp
cp_products = ::Katello::Resources::Candlepin::Product.all(organization.label, [:id, :name, :multiplier, :productContent])
cp_products = cp_products.select { |prod| Glue::Candlepin::Product.engineering_product_id?(prod['id']) }
prod_content_importer = Katello::ProductContentImporter.new(cp_products)
- 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 to_status
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.to_status(rhel_eos_schedule_index: nil)
release = rhel_eos_schedule_index
return UNKNOWN unless release.present? && RHEL_EOS_SCHEDULE.key?(release)
approach = approaching_end_of_category(eos_schedule_index: release)
if approach.present?
- 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 authorize_activation_key_content_view
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def authorize_activation_key_content_view(view, options)
key_content_view_id = options[:key_content_view_id]
if key_content_view_id
key_content_view = ContentView.where(:organization_id => view.organization,
:id => key_content_view_id).first
- 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 humanized_action
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def humanized_action
if export?
_("Exported version")
elsif publish?
_("Published new version")
- 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 authorize_activation_key_environments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def authorize_activation_key_environments(view, options)
key_environment_id = options[:key_environment_id]
if key_environment_id
key_env = KTEnvironment.where(:organization_id => view.organization,
:id => key_environment_id).first
- 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_bulk_items
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_bulk_items(bulk_params:, model_scope:, key: :id)
if bulk_params.is_a?(String)
bulk_params = ActiveSupport::JSON.decode(bulk_params).
deep_symbolize_keys
end
- 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 sync_progress
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sync_progress
return {:state => nil} unless @repo
return empty_task(@repo) unless @task
display_output = @task.humanized[:output]
display_output = display_output.split("\n")[0] if (display_output && @repo.version_href)
- 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 authorized_components
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private def authorized_components
components = params.require(:components).map do |component|
component = component.permit([:latest, :content_view_version_id, :content_view_id])
options = {}
options[:latest] = ::Foreman::Cast.to_bool(component[:latest]) if component.key?(:latest)
- 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_content_for_repo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_content_for_repo(repository_href, content_unit_href)
content_unit_href = [content_unit_href] unless content_unit_href.is_a?(Array)
api.repositories_api.modify(repository_href, add_content_units: content_unit_href)
rescue api.client_module::ApiError => e
if e.message.include? 'Could not find the following content units'
- 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_duplicate_unit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.find_duplicate_unit(repository, unit_type_id, file, checksum)
filter_label = :sha256
path_label = :relative_path
if unit_type_id == 'ostree_ref'
filter_label = :checksum
- 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 inputs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def inputs
case feature_name
when 'katello_errata_install'
{ :errata => errata_inputs }
when 'katello_service_restart'
- 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 generate_model_row
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.generate_model_row(unit)
keys = %w(title id severity issued_date type description reboot_suggested solution updated_date summary)
custom_json = unit.slice(*keys)
custom_json.inject(HashWithIndifferentAccess.new({})) { |h, (k, v)| h.merge({ k => v.respond_to?(:strip) ? v.strip : v }) }
custom_json['pulp_id'] = custom_json['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 get_remotes_api
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_remotes_api(href: nil, url: nil)
fail 'Provide exactly one of href or url for yum remote selection!' if url.blank? && href.blank?
fail 'The href must be a pulp_rpm remote href!' if href && !href.start_with?('/pulp/api/v3/remotes/rpm/')
if href&.start_with?('/pulp/api/v3/remotes/rpm/uln/') || url&.start_with?('uln')
- 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 filter_by_content_view
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def filter_by_content_view(query, content_view_id, environment_id, is_available_for)
if is_available_for
params[:library] = true
sub_query = ContentViewRepository.where(:content_view_id => content_view_id).pluck(:repository_id)
query = query.where("#{Repository.table_name}.id not in (#{sub_query.join(',')})") unless sub_query.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 validate_index_params!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_index_params!
if (params[:content_view_id] && params[:environment_id].nil?) || (params[:environment_id] && params[:content_view_id].nil?)
fail _("Either both parameters 'content_view_id' and 'environment_id' should be specified or neither should be specified")
end
if params[:type].present? && !TYPES_FROM_PARAMS.key?(params[:type].to_sym)
- 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 rule_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rule_params
unless @rule_params
if params[:content_view_filter_rule][:errata_ids].is_a?(Hash)
ids = process_errata_ids(params[:content_view_filter_rule][:errata_ids])
params[:content_view_filter_rule][:errata_ids] = ids
- 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_organization
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_organization(key = :organization_id)
organization = nil
if params.key?(key)
label = params[key].is_a?(ActionController::Parameters) ? params[key]['key'] : params[key]
- 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 update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update
cvv_id = component_params[:content_view_version_id]
if cvv_id && Katello::ContentViewVersion.readable.find_by(id: cvv_id).nil?
throw_resource_not_found(name: 'content view version', id: cvv_id)
end
- 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 render_bad_parameters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_bad_parameters(*args)
default_message = if request.xhr?
_('Invalid parameters sent in the request for this operation. Please contact a system administrator.')
else
_('Invalid parameters sent. You may have mistyped the address. If you continue having trouble with this, please contact an Administrator.')
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def status
begin
body = RestClient.get(pulp_url)
rescue => e
return {'fatal' => _('Unable to connect. Got: %s') % e}
- 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"