Showing 806 of 967 total issues
Method PackageDialog
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def PackageDialog(packages, install, message)
packages = deep_copy(packages)
Builtins.y2debug("Asking for packages: %1", packages)
packs = Builtins.filter(packages) do |package|
install ? !Installed(package) : Installed(package)
Method RemoveOldAllowedServiceFromZone
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def RemoveOldAllowedServiceFromZone(old_service_def, zone)
old_service_def = deep_copy(old_service_def)
Builtins.y2milestone("Removing: %1 from zone %2", old_service_def, zone)
if Ops.get_list(old_service_def, "tcp_ports", []) != []
Method PackageDialog
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def PackageDialog(packages, install, message)
log.info "Asking for packages: #{packages}"
packs = Builtins.filter(packages) do |package|
install ? !Installed(package) : Installed(package)
end
Method UpdateProductInfo
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def UpdateProductInfo(update_file, _filename)
update_file = deep_copy(update_file)
# merging all 'map <string, any>' type
Builtins.foreach(["globals", "software", "partitioning", "network"]) do |section|
sect = ProductFeatures.GetSection(section)
Method getClientTerm
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getClientTerm(step, def_, former_result)
step = deep_copy(step)
def_ = deep_copy(def_)
former_result = deep_copy(former_result)
client = getClientName(
Method StoreWorkflowFile
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def StoreWorkflowFile(file_from, file_to)
if file_from.nil? || file_from == "" || file_to.nil? || file_to == ""
Builtins.y2error("Cannot copy '%1' to '%2'", file_from, file_to)
return nil
end
Method ShutdownAllLocalDHCPClients
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ShutdownAllLocalDHCPClients
pid_directory = "/var/run/"
dhcp_pidfiles = Convert.convert(
WFM.Read(path(".local.dir"), pid_directory),
Method CheckNewCreatedFiles
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def CheckNewCreatedFiles(files)
new_files = created_files(files)
return true if new_files.empty?
Method GetMenuButtonWidget
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def GetMenuButtonWidget(actions, save, mb_label)
actions = deep_copy(actions)
menubutton = []
if save
# menubutton entry
Method parse_node
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_node(node, result)
name = node.name
# use only element children
children = node.children
children = children.select(&:element?)
Method has_attributes
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def has_attributes(*attributes, scope: nil, cache: false) # rubocop:disable Naming/PredicateName
scope_method = scope ? "#{scope}_" : ""
enable_modifications_cache if cache
define_method "attributes" do
attributes
Method IsOtherFirewallRunning
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def IsOtherFirewallRunning
any_firewall_running = true
# grep must return at least blank lines, else it returns 'exit 1' instead of 'exit 0'
command = "LANG=C /usr/sbin/iptables -L -n | /usr/bin/grep -v \"^\\(Chain\\|target\\)\""
Method RemoveWorkflow
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def RemoveWorkflow(type, src_id, name)
Builtins.y2milestone(
"Removing Workflow: Type %1, ID %2, Name %3",
type,
src_id,
Method Import
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Import(settings)
settings = deep_copy(settings)
@message_settings = Ops.get_map(settings, "messages", {})
@error_settings = Ops.get_map(settings, "errors", {})
@warning_settings = Ops.get_map(settings, "warnings", {})
Method run
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
func, param = Yast::WFM.Args
log.info "Called #{self.class}.run with #{func} and params #{param}"
case func
Method ConvertBackAndForth
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ConvertBackAndForth(strings_in, to_punycode)
# Some (or maybe all) strings needn't be cached
not_cached = []
# Check the cache for already entered strings
Method interface_label
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def interface_label(name)
return name if Mode.config
label = NetworkInterfaces.GetValue(name, "BOOTPROTO")
ipaddr = NetworkInterfaces.GetValue(name, "IPADDR")
- 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 ComputePackage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def ComputePackage
packages = GetPackages()
the_kernel = Ops.get(packages, 0, "")
Builtins.y2milestone("Selecting '%1' as kernel package", the_kernel)
- 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 SaveModulesToLoad
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def SaveModulesToLoad
modules_to_load
unless FileUtils.Exists(MODULES_DIR)
log.warn "Directory #{MODULES_DIR} does not exist, creating"
- 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 IsServiceSupportedInZone
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def IsServiceSupportedInZone(service, zone)
return nil if !IsKnownZone(zone)
Yast.import "SuSEFirewallServices" # lazy import due to circular dependencies
- 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"