Showing 806 of 967 total issues
Method MergeWorkflows
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def MergeWorkflows
Builtins.y2milestone("Merging additional control files from scratch...")
@unmerged_changes = false
# Init the Base Workflow settings
Method main
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def main
# an example client which uses Progress::
Yast.import "Progress"
Yast.import "Wizard"
Method add_element
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def add_element(doc, metadata, parent, contents, parent_array: nil)
# backward compatibility. Keys are sorted and needs old ycp sort to be able to compare also classes
Builtins.sort(contents.keys).each do |key|
raise XMLSerializationError.new("Cannot represent non-string key '#{key.inspect}', part of #{contents.inspect}", contents) unless key.is_a?(::String)
Method GenericTreeDialog
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def GenericTreeDialog(button_box)
button_box = deep_copy(button_box)
VBox(
Id(:WizardDialog),
ReplacePoint(Id(:topmenu), Empty()),
Method updateButtons
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def updateButtons(descr)
descr = deep_copy(descr)
Builtins.y2milestone("update buttons")
id = Convert.to_string(UI.QueryWidget(Id(:_tw_table), :CurrentItem))
item_list = Convert.convert(
Method ValidateValueType
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def ValidateValueType(key, value, widget, popup)
value = deep_copy(value)
success = true
if popup
case key
Method LazyInit
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def LazyInit
# already initialized
return if @initialized
Builtins.y2milestone("Initializing...")
Method SubprogressType
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def SubprogressType(type, max_value)
return if !@visible || Mode.commandline
Builtins.y2debug(
"SubprogressType: type: %1, max_value: %2",
Method PopState
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def PopState
# pop the config
state = Ops.get(
@progress_stack,
Ops.subtract(Builtins.size(@progress_stack), 1),
Method OpenSuperior
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def OpenSuperior(title, stages)
stages = deep_copy(stages)
if UI.HasSpecialWidget(:Wizard)
Wizard.OpenAcceptAbortStepsDialog
UI.WizardCommand(term(:AddStepHeading, title))
Method UpdateProposal
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def UpdateProposal
last_known_interfaces = GetKnownInterfaces()
currently_known_interfaces = SuSEFirewall.GetListOfKnownInterfaces
had_dialup_interfaces = false
Method IsValidPortRange
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def IsValidPortRange(port_range)
# not a port range
if !IsPortRange(port_range)
warning = Builtins.sformat("Not a port-range %1", port_range)
Builtins.y2milestone(warning) if ReportOnlyOnce(warning)
Method UnDisableAllModulesAndProposals
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def UnDisableAllModulesAndProposals(mode, stage)
this_workflow = { "mode" => mode, "stage" => stage }
# Such mode/stage not disabled
if !Builtins.contains(@already_disabled_workflows, this_workflow)
Method UpdateProposals
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def UpdateProposals(proposals, prod_name, domain)
proposals = deep_copy(proposals)
Builtins.foreach(proposals) do |proposal|
name = Ops.get_string(proposal, "name", "")
stage = Ops.get_string(proposal, "stage", "")
Method ShowAndRun
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def ShowAndRun(settings)
settings = deep_copy(settings)
if settings["widgets"]
widgets = settings["widgets"]
settings["widget_names"] ||= []
Method ModuleError
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def ModuleError(text)
success = UI.OpenDialog(
Opt(:decorated, :warncolor),
HBox(
HSpacing(1),
Method DefaultRunlevel
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def DefaultRunlevel
target = Convert.to_string(
SCR.Read(path(".target.symlink"), @default_target_symlink)
)
Builtins.y2milestone("Default symlink points to: %1", target)
Method BrowseTreeHelper
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def BrowseTreeHelper(variable, indent)
variable = deep_copy(variable)
simple = FormatSimpleType(variable, indent)
return Item(simple) unless simple.nil?
Method parse_node
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse_node(node, result)
name = node.name
# use only element children
children = node.children
children = children.select(&:element?)
- 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 generate_config
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def generate_config(pth, values)
config = {}
values.each do |val|
item = SCR.Read(path("#{pth}.#{val}"))
log.debug("item=#{item}")
- 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"