File sw_mgmt.rb
has 450 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yast"
require "tmpdir"
require "fileutils"
require "ostruct"
Class SwMgmt
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class SwMgmt
include Yast
include Yast::Logger
extend Yast::I18n
Method evaluate_product
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.evaluate_product(p, selected, installed)
if Stage.initial && Mode.auto
Yast.import "AutoinstFunctions"
# note: AutoinstFunctions.selected_product should never be nil when
# AY let it pass here
- 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_service
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.add_service(product_service, credentials)
# save repositories before refreshing added services (otherwise
# pkg-bindings will treat them as removed by the service refresh and
# unload them)
if !Pkg.SourceSaveAll
- 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_service
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.add_service(product_service, credentials)
# save repositories before refreshing added services (otherwise
# pkg-bindings will treat them as removed by the service refresh and
# unload them)
if !Pkg.SourceSaveAll
Method find_base_product
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.find_base_product
# FIXME: refactor the code to use Y2Packager::Product
# just for debugging:
return FAKE_BASE_PRODUCT if ENV["FAKE_BASE_PRODUCT"]
- 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 init
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.init(load_packages = false)
# false = do not allow continuing without the libzypp lock
lock = PackageLock.Connect(false)
# User would like to abort
raise_pkg_exception(PkgAborted) if lock["aborted"]
- 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 check_repositories
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.check_repositories
# only enabled repositories
repos = Pkg.SourceGetCurrent(true)
repos.each 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
Method target_distribution
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.target_distribution(destdir)
if Y2Packager::MediumType.online?
control_products = Y2Packager::ProductSpec.base_products
target_distro = if control_products.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 copy_old_credentials
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.copy_old_credentials(source_dir)
log.info "Searching registration credentials in #{source_dir}..."
dir = SUSE::Connect::YaST::DEFAULT_CREDENTIALS_DIR
# create the target directory if missing
- 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 online_base_product
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.online_base_product
if Mode.update
prods = Y2Packager::ProductSpec.base_products
installed_names = installed_products.map { |p| p["name"] }
prod = prods.find { |p| installed_names.include?(p.name) }
- 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_release_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.get_release_type(product)
if product["product_line"] && !product["product_line"].empty?
oem_file = File.join(OEM_DIR, product["product_line"])
if File.exist?(oem_file)
- 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"