Showing 806 of 967 total issues
Method find_many_at_once
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def find_many_at_once(service_names, propmap = UnitPropMap.new)
return [] if Yast::Stage.initial
snames = service_names.map { |n| n + UNIT_SUFFIX unless n.end_with?(UNIT_SUFFIX) }
snames_s = snames.join(" ")
- 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 CutRegexMatch
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def CutRegexMatch(input, regex, glob)
return "" if input.nil? || input.empty?
output = input
if Builtins.regexpmatch(output, regex)
- 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 FormatSizeWithPrecision
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def FormatSizeWithPrecision(bytes, precision, omit_zeroes)
return "" if bytes.nil?
units = [
# Byte abbreviated
- 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 LogHandle
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def LogHandle(_key, event)
event = deep_copy(event)
@param = CWM.GetProcessedWidget
LogViewCore.Update(Id(:_cwm_log))
ret = Ops.get(event, "ID")
Method List
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def List(devregex)
ret = []
if devregex == "" || devregex.nil?
Builtins.maplist(@Devices) do |_t, d|
Builtins.maplist(
Method InstallKernel
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def InstallKernel(kernel_modules)
kernel_modules = deep_copy(kernel_modules)
# this function may be responsible for the horrible startup time
Builtins.y2milestone("want: %1", kernel_modules)
if kernel_modules == []
Method IntegrateWorkflow
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def IntegrateWorkflow(filename)
Builtins.y2milestone("IntegrateWorkflow %1", filename)
begin
update_file = XML.XMLToYCPFile(filename)
Method AssertLineValid
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def AssertLineValid(file, line)
if Builtins.haskey(Ops.get_map(file.value, "l", {}), line) &&
Ops.get_boolean(file.value, ["l", line, "buildline"], false)
delim = Builtins.substring(
Ops.get_string(file.value, "delim", " "),
Method mergeTables
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mergeTables(new, old)
new = deep_copy(new)
old = deep_copy(old)
# make a true map
new_m = Builtins.listmap(new) do |e|
Method AnyQuestionRichText
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def AnyQuestionRichText(headline, richtext, hdim, vdim, yes_button_message, no_button_message, focus)
yes_button = PushButton(
Id(:ok),
if focus == :focus_yes
Opt(:default, :key_F10, :okButton)
Method main
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main
Yast.import "UI"
Yast.import "Label"
Yast.import "Popup"
Yast.import "Mode"
Method MediaChange
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def MediaChange(error_code, error, url, product, current, current_label, wanted, wanted_label, double_sided, devices, current_device)
Method CheckFiles
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def CheckFiles(files)
files = deep_copy(files)
files = Builtins.filter(files) { |f| FileChanged(f) }
return true unless Ops.greater_than(Builtins.size(files), 0)
Method WriteConfiguration
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def WriteConfiguration
# just disabled
return true if !SuSEFirewallIsInstalled()
return false if !GetModified()
Method ReplaceProposalModule
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ReplaceProposalModule(proposal, old, new)
proposal = deep_copy(proposal)
new = deep_copy(new)
found = false
Method main
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main
Yast.import "UI"
Yast.import "Pkg"
textdomain "base"
Method UpdateProgressBar
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def UpdateProgressBar
if Ops.greater_than(@current_step, @steps)
Builtins.y2error(
-2,
"Progress bar has only %1 steps, not %2.",
Method ReadConfig
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ReadConfig(config)
Builtins.y2debug("config=%1", config)
return {} if config.nil?
ret = {}
Method ArePortsOrServicesAllowed
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ArePortsOrServicesAllowed(needed_ports, protocol, zone, check_for_aliases)
needed_ports = deep_copy(needed_ports)
are_allowed = true
if Ops.less_than(Builtins.size(needed_ports), 1)
Method SetAdditionalServices
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def SetAdditionalServices(protocol, zone, new_list_services)
new_list_services = deep_copy(new_list_services)
old_list_services = Builtins.toset(GetAdditionalServices(protocol, zone))
new_list_services = Builtins.toset(new_list_services)