Showing 218 of 255 total issues
Method Packages
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def Packages
backend = if Mode.autoinst
Y2Network::Backend.all.find { |b| b.id == proposal_settings.current_backend }
else
yast_config&.backend
- 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 command_line_definition
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def command_line_definition
{
# Commandline help title
"help" => _(
"Remote Access Configuration"
Method main
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main
Yast.import "UI"
textdomain "network"
Method EditHandler
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def EditHandler(options)
destination = options["dest"]
if destination == ""
CommandLine.Error(_("Destination IP address must be specified."))
Method Update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def Update(oldhn, newhn, ip)
raise ArgumentError, "IP cannot be nil" if ip.nil?
raise ArgumentError, "Nonempty IP expected" if ip.empty?
log.info("Updating /etc/hosts: #{oldhn} -> #{newhn}: #{ip}")
- 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 validate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate
return true if value != :bootproto_static
ipa = Yast::UI.QueryWidget(:bootproto_ipaddr, :Value)
if !Yast::IP.Check(ipa)
- 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 tabs_descr
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tabs_descr
return @tabs_descr if @tabs_descr
@tabs_descr = {
"global" => {
Method contents
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def contents
RadioButtonGroup(
VBox(
# Small spacing (bsc#988904)
VSpacing(0.3),
Method option_handlers
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def option_handlers
{
hostname => {
"validator" => fun_ref(method(:valid_hostname?), "boolean (string)"),
"setter" => fun_ref(method(:SetHostname), "void (any)"),
Method PackagesInstall
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def PackagesInstall(packages)
packages = deep_copy(packages)
return :next if packages == []
log.info "Checking packages: #{packages}"
Method LanSequence
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def LanSequence
aliases = {
"read" => [-> { ReadDialog() }, true],
"main" => -> { MainSequence("") },
"write" => [-> { WriteDialog() }, true]
Method EditHandler
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def EditHandler(options)
log.info("Edit handler, options: #{options.inspect}")
# validator: a reference to boolean( string) is expected
# setter: a reference to void( any) is expected
Method update_builder_from_options!
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_builder_from_options!(builder, options)
case builder.type.short_name
when "bond"
# change only if user specify it
builder.ports = options["bond_ports"].split if options["bond_ports"]
Method dialog
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dialog(value = nil)
value ||= ""
Yast::UI.OpenDialog(
Opt(:decorated),
VBox(
Method contents
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def contents
Frame(
Id(:additional_addresses),
# Frame label
_("Additional Addresses"),
Method handle
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle(event)
return nil if event["EventReason"] != "Activated"
cur = Yast::UI.QueryWidget(Id(:wep_keys_table), :CurrentItem).to_i
case event["ID"]
Method main
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main
Yast.import "UI"
textdomain "network"
Yast.import "Arch"
Method contents
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def contents
HBox(
HSpacing(4),
VBox(
VSpacing(0.5),
Method help
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def help
res = _(
"<p><b><big>Address Setup</big></b></p>\n" \
"<p>Select <b>No Address Setup</b> if you do not want " \
"to assign an IP address to this device.\n" \
Method contents
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def contents
ifplugd_widget = IfplugdPriority.new(@settings)
MarginBox(
1,
0,