Method available_repositories
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def available_repositories
scan_cdn = sync_task(::Actions::Katello::RepositorySet::ScanCdn, @product, @product_content.content.cp_content_id)
repos = scan_cdn.output[:results]
repos = repos.select do |repo|
- 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
Class RepositorySetsController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Api::V2::RepositorySetsController < Api::V2::ApiController
respond_to :json
include Katello::Concerns::FilteredAutoCompleteSearch
Method index_relation
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def index_relation
if @product.nil?
authorized_product_contents = Katello::ProductContent.joins(:product).merge(@product_scope)
relation = @organization.product_contents.merge(authorized_product_contents).displayable
else
- 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 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,
- 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 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
- 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 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]
- 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"