Method plan
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def plan(old_version, environments, options = {})
dep_solve = options.fetch(:resolve_dependencies, true)
description = options.fetch(:description, '')
content = options.fetch(:content, {})
new_components = options.fetch(:new_components, [])
- 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 plan
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def plan(old_version, environments, options = {})
dep_solve = options.fetch(:resolve_dependencies, true)
description = options.fetch(:description, '')
content = options.fetch(:content, {})
new_components = options.fetch(:new_components, [])
File incremental_update.rb
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Actions
module Katello
module ContentViewVersion
class IncrementalUpdate < Actions::EntryAction
include ::Katello::ContentViewHelper
Method components_repo_instances
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def components_repo_instances(old_version_repo, new_component_versions)
# Attempt to locate the repo instance in the new component versions
new_repos = nil
new_component_versions.map do |cvv|
cvv.repositories.each do |component_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
Method components_repo_instances
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def components_repo_instances(old_version_repo, new_component_versions)
# Attempt to locate the repo instance in the new component versions
new_repos = nil
new_component_versions.map do |cvv|
cvv.repositories.each do |component_repo|
Method pulp3_repo_mapping
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def pulp3_repo_mapping(repo_mapping, old_version)
pulp3_repo_mapping = {}
repo_mapping.each do |source_repos, dest_repo|
old_version_repo = old_version.repositories.archived.find_by(root_id: dest_repo.root_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 run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
content = { ::Katello::Erratum::CONTENT_TYPE => [],
::Katello::Rpm::CONTENT_TYPE => [],
::Katello::ModuleStream::CONTENT_TYPE => [],
::Katello::Deb::CONTENT_TYPE => []
Consider simplifying this complex logical expression. Open
if input[:is_composite] || input[:copy_action_outputs].present? && input[:copy_action_outputs].last[:pulp_tasks].present?
new_repos.each do |new_repo|
matched_old_repo = base_repos.where(root_id: new_repo.root_id).first
new_errata = new_repo.errata - (matched_old_repo&.errata || [])
Method plan_copy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def plan_copy(action_class, source_repo, target_repo, clauses = nil, override_config = nil)
Method validate_content
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_content(old_version, content, components)
if old_version.content_view.composite?
fail(_("Cannot specify content for composite views")) unless content.empty?
validate_components(old_version, components)
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 finalize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def finalize
version = ::Katello::ContentViewVersion.find(input[:new_content_view_version_id])
version.update_content_counts!
version.add_applied_filters!
generate_description(version, output[:added_units]) if version.description.blank?
- 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"