From 1454470bf6b949042af7738eb426b3c27b683626 Mon Sep 17 00:00:00 2001
From: Josef Reidinger
Date: Wed, 6 Mar 2024 22:08:48 +0100
Subject: [PATCH 1/3] new rubocop and autocorrection with -a
---
.rubocop.yml | 4 +-
src/include/s390/dasd/dialogs.rb | 20 ++++-----
src/include/s390/dasd/helps.rb | 24 +++++------
src/include/s390/dump/ui.rb | 12 +++---
src/include/s390/iucvterminal-server/helps.rb | 32 +++++++-------
src/include/s390/iucvterminal-server/ui.rb | 34 +++++++--------
src/include/s390/iucvterminal/ui.rb | 42 +++++++++----------
src/include/s390/onpanic/ui.rb | 20 ++++-----
src/include/s390/xpram/ui.rb | 6 +--
src/include/s390/zfcp/helps.rb | 36 ++++++++--------
src/lib/y2s390/dasd.rb | 2 +-
src/lib/y2s390/dasd_actions/format.rb | 4 +-
src/lib/y2s390/dasds_collection.rb | 2 +-
src/lib/y2s390/dasds_reader.rb | 2 +-
src/lib/y2s390/format_process.rb | 1 +
src/modules/IUCVTerminalServer.rb | 10 ++---
src/modules/OnPanic.rb | 8 ++--
src/modules/Xpram.rb | 6 +--
src/modules/ZFCPController.rb | 28 ++++++-------
test/dasd_dialogs_include_test.rb | 2 +-
test/ui_include_test.rb | 2 +-
test/ui_onpanic_include_test.rb | 2 +-
test/y2s390/dasd_actions/activate_test.rb | 2 +-
test/y2s390/dasd_actions/base_test.rb | 2 +-
test/y2s390/dasd_actions/deactivate_test.rb | 2 +-
test/y2s390/dasd_actions/diag_test.rb | 2 +-
test/y2s390/dasd_actions/format_test.rb | 2 +-
test/y2s390/dialogs/format_dialog_test.rb | 2 +-
28 files changed, 152 insertions(+), 159 deletions(-)
diff --git a/.rubocop.yml b/.rubocop.yml
index c8b52025..264c849a 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,6 +1,6 @@
# use the shared Yast defaults
inherit_from:
- /usr/share/YaST2/data/devtools/data/rubocop-0.71.0_yast_style.yml
+ /usr/share/YaST2/data/devtools/data/rubocop-1.24.1_yast_style.yml
# Offense count: 82
Metrics/AbcSize:
@@ -21,7 +21,7 @@ Metrics/CyclomaticComplexity:
# Offense count: 152
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
# URISchemes: http, https
-Metrics/LineLength:
+Layout/LineLength:
Max: 110
# Offense count: 117
diff --git a/src/include/s390/dasd/dialogs.rb b/src/include/s390/dasd/dialogs.rb
index 8529511e..6c1e3840 100644
--- a/src/include/s390/dasd/dialogs.rb
+++ b/src/include/s390/dasd/dialogs.rb
@@ -101,29 +101,29 @@ def GetDASDDiskItems
end
def PossibleActions
- if !Mode.config
+ if Mode.config
[
- # menu button id
- Item(Id(:activate), _("&Activate")),
- # menu button id
- Item(Id(:deactivate), _("&Deactivate")),
# menu button id
Item(Id(:diag_on), _("Set DIAG O&n")),
# menu button id
Item(Id(:diag_off), _("Set DIAG O&ff")),
# menu button id
- Item(Id(:format), _("&Format"))
+ Item(Id(:format_on), _("Set Format On")),
+ # menu button id
+ Item(Id(:format_off), _("Set Format Off"))
]
else
[
+ # menu button id
+ Item(Id(:activate), _("&Activate")),
+ # menu button id
+ Item(Id(:deactivate), _("&Deactivate")),
# menu button id
Item(Id(:diag_on), _("Set DIAG O&n")),
# menu button id
Item(Id(:diag_off), _("Set DIAG O&ff")),
# menu button id
- Item(Id(:format_on), _("Set Format On")),
- # menu button id
- Item(Id(:format_off), _("Set Format Off"))
+ Item(Id(:format), _("&Format"))
]
end
end
@@ -148,7 +148,7 @@ def run(action, selected)
Object.const_get(action_class_for(action)).run(selected)
rescue NameError => e
log.error("No action for #{action}: #{e}")
- return false
+ false
end
end
diff --git a/src/include/s390/dasd/helps.rb b/src/include/s390/dasd/helps.rb
index 53614601..fffd95f0 100644
--- a/src/include/s390/dasd/helps.rb
+++ b/src/include/s390/dasd/helps.rb
@@ -37,7 +37,7 @@ def initialize_s390_dasd_helps(_include_target)
# Read dialog help 2/2
_(
"Aborting Initialization:
\nSafely abort the " \
- "configuration utility by pressing Abort now.
"
+ "configuration utility by pressing Abort now.
"
),
# Write dialog help 1/2
"write" => _(
@@ -46,18 +46,18 @@ def initialize_s390_dasd_helps(_include_target)
# Write dialog help 2/2
_(
"Aborting Saving:
\n" \
- "Abort the save procedure by pressing Abort.\n" \
- "An additional dialog will inform you whether it is safe to do so.
\n"
+ "Abort the save procedure by pressing Abort.\n" \
+ "An additional dialog will inform you whether it is safe to do so.\n"
),
# Disk selection dialog help 1/4
"disk_selection_config" => _(
"Configured DASD Disks
\nIn this dialog, manage DASD " \
- "disks on your system.
"
+ "disks on your system."
) +
# Disk selection dialog help 2/4
_(
"To filter the displayed disks, set the Minimum Channel ID and \n" \
- "the Maximum Channel ID and click Filter.
\n"
+ "the Maximum Channel ID and click Filter.\n"
) +
# Disk selection dialog help 4/4
_("To configure a new DASD disk, click Add.
") +
@@ -68,29 +68,29 @@ def initialize_s390_dasd_helps(_include_target)
# Disk selection dialog help 1/4
"disk_selection" => _(
"Configured DASD Disks
\nIn this dialog, manage DASD disks " \
- "on your system.
"
+ "on your system."
) +
# Disk selection dialog help 2/4
_(
"To filter the displayed disks, set the Minimum Channel ID and \n" \
- "the Maximum Channel ID and click Filter.
\n"
+ "the Maximum Channel ID and click Filter.\n"
) +
# Disk selection dialog help 3/4
_(
"To perform actions on multiple disks at once, mark these disks. To select " \
- "all displayed disk (possibly after applying a filter), click\nSelect All " \
- "or Deselect All.
\n"
+ "all displayed disk (possibly after applying a filter), click\nSelect All " \
+ "or Deselect All.\n"
) +
# Disk selection dialog help 4/4
_(
"To perform an action on the selected disks, use Perform Action.\n" \
- "The action will be performed immediately!
"
+ "The action will be performed immediately!"
),
# Disk add help 1/3
"disk_add_config" => _(
"Add New DASD Disk
\n" \
- "To add a disk, enter the Channel ID of the DASD disk as\n" \
- "identifier.
"
+ "To add a disk, enter the Channel ID of the DASD disk as\n" \
+ "identifier."
) +
# Disk add help 1/3
_(
diff --git a/src/include/s390/dump/ui.rb b/src/include/s390/dump/ui.rb
index 4f903824..b6b606f3 100644
--- a/src/include/s390/dump/ui.rb
+++ b/src/include/s390/dump/ui.rb
@@ -55,7 +55,7 @@ def DumpDialog
# Dump dialog help 3/8
_(
"Only whole disks can be used, no partitions. If the device is incompatibly\n" \
- "formatted or partitioned, activate the checkbox Force overwrite of disk."
+ "formatted or partitioned, activate the checkbox Force overwrite of disk."
) +
# Dump dialog help 4/8
_(
@@ -68,7 +68,7 @@ def DumpDialog
# Dump dialog help 6/8
_(
"dumpdevice after a disk indicates that it is a usable dump\ndevice. " \
- "Multi-volume dump devices are indicated by a list of DASD IDs.
"
+ "Multi-volume dump devices are indicated by a list of DASD IDs."
) +
# Dump dialog help 7/8
_("ZFCP columns: Device, Size, ID, WWPN, LUN, Dump
") +
@@ -169,10 +169,10 @@ def DumpDialog
Builtins.foreach(selected_items) do |device_line|
entries = Builtins.splitstring(device_line, "\t")
# prevent leading space
- device = if device != ""
- Ops.add(Ops.add(device, " "), Ops.get(entries, 0, ""))
- else
+ device = if device == ""
Ops.get(entries, 0, "")
+ else
+ Ops.add(Ops.add(device, " "), Ops.get(entries, 0, ""))
end
end
end
@@ -185,7 +185,7 @@ def DumpDialog
Builtins.sformat(
_(
"The disk %1 will be formatted as a dump device. All data on " \
- "this device will be lost! Continue?"
+ "this device will be lost! Continue?"
),
device
)
diff --git a/src/include/s390/iucvterminal-server/helps.rb b/src/include/s390/iucvterminal-server/helps.rb
index f180c5e9..fe38a6de 100644
--- a/src/include/s390/iucvterminal-server/helps.rb
+++ b/src/include/s390/iucvterminal-server/helps.rb
@@ -36,7 +36,7 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
) +
_(
"
To configure the IUCV terminal server, specify the z/VM IDs to be used.\n
" \
- "They are separated by line breaks.
\n"
+ "They are separated by line breaks.\n"
),
# TS-Shell dialog help 1/5
"ts" => _(
@@ -44,23 +44,23 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
) +
_(
"TS-Shell allows to specify Authorization for every TS-Shell user and group. " \
- "The rights of a group are inherited by its members.
"
+ "The rights of a group are inherited by its members."
) +
# TS-Shell dialog help 2/5
_(
"Each allowed z/VM ID can be selected manually under Selection, defined by " \
- "a Regex or loaded from a File which contains all allowed z/VM IDs " \
- "separated by line breaks.
"
+ "a Regex or loaded from a File which contains all allowed z/VM IDs " \
+ "separated by line breaks."
) +
# TS-Shell dialog help 3/5
_(
"Click on New User to create new TS-Shell users or Delete\nUser " \
- "to remove users.
"
+ "to remove users."
) +
# TS-Shell dialog help 4/5
_(
"To add or remove groups from the TS-Shell authorization table or to change\n" \
- "the membership of users, go to Manage Groups.
"
+ "the membership of users, go to Manage Groups."
) +
# TS-Shell dialog help 5/5
_(
@@ -72,8 +72,8 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
) +
_(
"To create new TS-Shell user the Username, Home Directory and " \
- "Password has to be provided.\n\t
It is also possible to specify " \
- "Additional Groups by selecting them on the right.
"
+ "Password has to be provided.\n\t
It is also possible to specify " \
+ "Additional Groups by selecting them on the right."
) +
# TS-Shell User creation dialog help 2/3
_(
@@ -83,7 +83,7 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
# TS-Shell User creation dialog help 3/3
_(
"You can specify the same home directory for every TS-Shell user since no\n" \
- "data will be stored there.
"
+ "data will be stored there."
),
# TS-Shell Managing Groups dialog help 1/5
"ts-group" => _(
@@ -91,13 +91,13 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
) +
_(
"Define TS-Shell authorizations per group if you want every TS-Shell \n" \
- "member of this groups to inherit the same rights.
"
+ "member of this groups to inherit the same rights."
) +
# TS-Shell Managing Groups dialog help 2/5
_(
"Existing groups can be added to or removed from the TS-Shell\n" \
- "authorization. Select the groups in the table and click on Select or Deselect. " \
- "The current status is shown in the column TS-Auth.
"
+ "authorization. Select the groups in the table and click on Select or Deselect. " \
+ "The current status is shown in the column TS-Auth."
) +
# TS-Shell Managing Groups dialog help 3/5
_(
@@ -106,8 +106,8 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
# TS-Shell Managing Groups dialog help 4/5
_(
"New groups could be created by entering the name in the New Group input field " \
- "and confirming with Create.\n\t
To delete previously created groups the " \
- "YaST users dialog has to be used.
"
+ "and confirming with Create.\n\t
To delete previously created groups the " \
+ "YaST users dialog has to be used."
) +
# TS-Shell Managing Groups dialog help 5/5
_(
@@ -119,12 +119,12 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
) +
_(
"IUCVConn on Login needs one user for every z/VM ID. To create these users " \
- "a password and home directory has to be provided."
+ "a password and home directory has to be provided."
) +
# IUCVConn on Login dialog help 2/2
_(
"
It is possible to sync the users manually by clicking on Sync or just " \
- "confirming the changes with Ok while IUCVConn on Login is enabled.
"
+ "confirming the changes with Ok while IUCVConn on Login is enabled. "
)
}
# EOF
diff --git a/src/include/s390/iucvterminal-server/ui.rb b/src/include/s390/iucvterminal-server/ui.rb
index 124153cd..b1904939 100644
--- a/src/include/s390/iucvterminal-server/ui.rb
+++ b/src/include/s390/iucvterminal-server/ui.rb
@@ -734,7 +734,10 @@ def CommitTsUserDialogSettings
groupmap,
force_pw_change
)
- if new_uid != ""
+ if new_uid == ""
+ Popup.Notify(_("Adding the user has failed."))
+ ret = false
+ else
@ts_member_conf = Builtins.add(
@ts_member_conf,
username,
@@ -743,9 +746,6 @@ def CommitTsUserDialogSettings
rb_ts_regex: "",
rb_ts_file: ""
)
- else
- Popup.Notify(_("Adding the user has failed."))
- ret = false
end
end
ret
@@ -969,9 +969,9 @@ def CheckPassword(field1, field2)
pw1 = Convert.to_string(UI.QueryWidget(Id(field1), :Value))
if pw1 != "" &&
pw1 == Convert.to_string(UI.QueryWidget(Id(field2), :Value))
- return pw1
+ pw1
else
- return ""
+ ""
end
end
@@ -990,7 +990,7 @@ def IsValidZvmIdList
line = Ops.add(line, 1)
# since alnum allows umlauts too the id is checked against the user name specification
if Builtins.regexpmatch(zvmid, "[^[:alnum:]]") ||
- !IUCVTerminalServer.CheckUserGroupName(zvmid) && zvmid != ""
+ (!IUCVTerminalServer.CheckUserGroupName(zvmid) && zvmid != "")
Popup.Notify(
Builtins.sformat(
_(
@@ -1050,24 +1050,22 @@ def SyncIucvConnUsers
ret = false
# check if the ic users list is different since the start
- if @zvm_id_list != IUCVTerminalServer.GetIcUsersList
+ if @zvm_id_list == IUCVTerminalServer.GetIcUsersList
+ ret = true
+ elsif @ic_password == ""
# check password
- if @ic_password == ""
- Popup.Notify(
+ Popup.Notify(
_(
"A correctly entered password to sync IUCVConn users is required."
)
)
# check home directory
- elsif !Builtins.regexpmatch(@ic_home, "^/")
- Popup.Notify(_("The specified IUCVConn home directory is invalid."))
- else
- IUCVTerminalServer.ic_home = @ic_home
- IUCVTerminalServer.SyncIucvConnUsers(@zvm_id_list, @ic_password)
- UI.ChangeWidget(Id(:ic_users), :Items, GenerateIcUsersTable())
- ret = true
- end
+ elsif !Builtins.regexpmatch(@ic_home, "^/")
+ Popup.Notify(_("The specified IUCVConn home directory is invalid."))
else
+ IUCVTerminalServer.ic_home = @ic_home
+ IUCVTerminalServer.SyncIucvConnUsers(@zvm_id_list, @ic_password)
+ UI.ChangeWidget(Id(:ic_users), :Items, GenerateIcUsersTable())
ret = true
end
ret
diff --git a/src/include/s390/iucvterminal/ui.rb b/src/include/s390/iucvterminal/ui.rb
index 29665741..bdcf2c67 100644
--- a/src/include/s390/iucvterminal/ui.rb
+++ b/src/include/s390/iucvterminal/ui.rb
@@ -122,20 +122,20 @@ def TerminalDialog
# IUCVTerminal dialog help 3/11
_(
"Several IUCVtty instances can run to provide multiple terminal devices. " \
- "The instances are distinguished by a terminal ID, which is a combination of " \
- "the Terminal ID Prefix and the number of the instance.
"
+ "The instances are distinguished by a terminal ID, which is a combination of " \
+ "the Terminal ID Prefix and the number of the instance.
"
) +
# IUCVTerminal dialog help 4/11
_(
"For example, if you define ten instances with the prefix "lxterm", " \
- "the terminal IDs from lxterm0 to lxterm9 are available.
"
+ "the terminal IDs from lxterm0 to lxterm9 are available."
) + "
" +
# IUCVTerminal dialog help 5/11
_("HVC
") +
# IUCVTerminal dialog help 6/11
_(
"The z/VM IUCV HVC device driver is a kernel module and uses device nodes to " \
- "enable up to eight HVC terminal devices to communicate with getty and login programs.
"
+ "enable up to eight HVC terminal devices to communicate with getty and login programs."
) +
# IUCVTerminal dialog help 7/11
_(
@@ -148,17 +148,17 @@ def TerminalDialog
# IUCVTerminal dialog help 9/11
_(
"Activate route kernel messages to hvc0 to route kernel messages to\n" \
- "the hvc0 device instead of ttyS0.
"
+ "the hvc0 device instead of ttyS0.
"
) +
# IUCVTerminal dialog help 10/11
_(
"Should kernel messages still be shown on ttyS0, manually add console=ttyS0 " \
- "to the current boot selection kernel parameter in the YaST bootloader module.
"
+ "to the current boot selection kernel parameter in the YaST bootloader module."
) +
# IUCVTerminal dialog help 11/11
_(
"Warning: HVC Terminals stay logged on without a manual logout through " \
- "the shortcut: ctrl _ d
"
+ "the shortcut: ctrl _ d"
)
# Dialog content
@@ -297,28 +297,28 @@ def TerminalDialog
# check for changes on final user actions
if [:back, :abort, :cancel, :next, :ok, :finish].include?(ret)
- IUCVTerminal.modified = IUCVTerminal.iucv_instances == 0 &&
- UI.QueryWidget(Id(:iucv), :Value) ||
- IUCVTerminal.iucv_instances != 0 &&
- !UI.QueryWidget(Id(:iucv), :Value) ||
- IUCVTerminal.iucv_instances != 0 &&
+ IUCVTerminal.modified = (IUCVTerminal.iucv_instances == 0 &&
+ UI.QueryWidget(Id(:iucv), :Value)) ||
+ (IUCVTerminal.iucv_instances != 0 &&
+ !UI.QueryWidget(Id(:iucv), :Value)) ||
+ (IUCVTerminal.iucv_instances != 0 &&
IUCVTerminal.iucv_instances !=
- UI.QueryWidget(Id(:iucv_instances), :Value) ||
+ UI.QueryWidget(Id(:iucv_instances), :Value)) ||
IUCVTerminal.iucv_name !=
UI.QueryWidget(Id(:iucv_name), :Value) ||
- IUCVTerminal.hvc_instances != 0 &&
+ (IUCVTerminal.hvc_instances != 0 &&
IUCVTerminal.hvc_instances !=
- UI.QueryWidget(Id(:hvc_instances), :Value) ||
- IUCVTerminal.hvc_instances == 0 &&
- UI.QueryWidget(Id(:hvc), :Value) ||
- IUCVTerminal.hvc_instances != 0 &&
- !UI.QueryWidget(Id(:hvc), :Value) ||
+ UI.QueryWidget(Id(:hvc_instances), :Value)) ||
+ (IUCVTerminal.hvc_instances == 0 &&
+ UI.QueryWidget(Id(:hvc), :Value)) ||
+ (IUCVTerminal.hvc_instances != 0 &&
+ !UI.QueryWidget(Id(:hvc), :Value)) ||
IUCVTerminal.show_kernel_out_on_hvc !=
UI.QueryWidget(Id(:show_kernel_out_on_hvc), :Value) ||
IUCVTerminal.restrict_hvc_to_srvs !=
UI.QueryWidget(Id(:restrict_hvc_to_srvs), :Value) ||
- IUCVTerminal.restrict_hvc_to_srvs != "" &&
- !UI.QueryWidget(Id(:is_hvc_restricted), :Value)
+ (IUCVTerminal.restrict_hvc_to_srvs != "" &&
+ !UI.QueryWidget(Id(:is_hvc_restricted), :Value))
# if settings were changed don't exit without asking
if [:back, :abort, :cancel].include?(ret) &&
diff --git a/src/include/s390/onpanic/ui.rb b/src/include/s390/onpanic/ui.rb
index b3a67c83..60f7a779 100644
--- a/src/include/s390/onpanic/ui.rb
+++ b/src/include/s390/onpanic/ui.rb
@@ -115,7 +115,7 @@ def OnPanicDialog
# OnPanic dialog help 2/11
_(
"The Dumpconf daemon needs to be enabled to influence the behavior " \
- "during kernel panics.
"
+ "during kernel panics."
) +
# OnPanic dialog help 3/11
_("The following Panic Actions are possible:
") +
@@ -128,26 +128,26 @@ def OnPanicDialog
# OnPanic dialog help 7/11
_(
"dump_reipl Dump Linux and reboot system. This option is only " \
- "available\non LPAR with z9(r) machines and later and on z/VMversion 5.3 and later.
"
+ "available\non LPAR with z9(r) machines and later and on z/VMversion 5.3 and later.
"
) +
# OnPanic dialog help 8/11
_("vmcmd Execute specified CP commands and stop system.
") +
# OnPanic dialog help 9/11
_(
"The time defined in Delay Minutes defers activating the specified " \
- "panic action for a newly started system to prevent loops. If the system " \
- "crashes before the time has elapsed the default action (stop) is performed.
"
+ "panic action for a newly started system to prevent loops. If the system " \
+ "crashes before the time has elapsed the default action (stop) is performed."
) +
# OnPanic dialog help 10/11
_(
"The device for dumping the memory can be set with Dump Device. If no " \
- "device is shown you have to create one with the YaST Dump Devices dialog.
"
+ "device is shown you have to create one with the YaST Dump Devices dialog."
),
# OnPanic dialog help 11/11
Builtins.sformat(
_(
"With VMCMD specify CP commands to be executed before the Linux " \
- "system is stopped. Only %1 lines and a total of %2 chars are allowed.
"
+ "system is stopped. Only %1 lines and a total of %2 chars are allowed."
),
OnPanic.VMCMD_MAX_ROWS,
OnPanic.VMCMD_MAX_CHARS
@@ -317,17 +317,15 @@ def OnPanicDialog
# because it conflicts with OnPanic
def check_kdump
if OnPanic.start &&
- (Service.Enabled(KDUMP_SERVICE_NAME) || Service.Active(KDUMP_SERVICE_NAME))
- if Yast::Popup.YesNo(
+ (Service.Enabled(KDUMP_SERVICE_NAME) || Service.Active(KDUMP_SERVICE_NAME)) && Yast::Popup.YesNo(
# TRANSLATORS: %{s1},%{s2} are the service names
format(_(
"The service %{s1} is active and will conflict with dumpconf.\n" \
"Would you like to disable %{s2}? \n"
), s1: KDUMP_SERVICE_NAME, s2: KDUMP_SERVICE_NAME)
)
- Service.Disable(KDUMP_SERVICE_NAME)
- Service.Stop(KDUMP_SERVICE_NAME) if Service.active?(KDUMP_SERVICE_NAME)
- end
+ Service.Disable(KDUMP_SERVICE_NAME)
+ Service.Stop(KDUMP_SERVICE_NAME) if Service.active?(KDUMP_SERVICE_NAME)
end
end
diff --git a/src/include/s390/xpram/ui.rb b/src/include/s390/xpram/ui.rb
index 89571f9f..1a02445d 100644
--- a/src/include/s390/xpram/ui.rb
+++ b/src/include/s390/xpram/ui.rb
@@ -50,9 +50,9 @@ def XpRAMDialog
# help text for XPRAM 2/4
_(
"This tool currently only supports assigning the entire XPRAM to one partition. " \
- "To have multiple partitions, look at \"Device Drivers, Features and Commands " \
- "November 30, 2004\" for the Linux kernel 2.6 - April 2004 stream.
" \
- "In this case disable XPRAM in this module.
"
+ "To have multiple partitions, look at \"Device Drivers, Features and Commands " \
+ "November 30, 2004\" for the Linux kernel 2.6 - April 2004 stream." \
+ "In this case disable XPRAM in this module.
"
) +
# help text for XPRAM 3/4
_("Choose the correct mount point for Mount Point.
") +
diff --git a/src/include/s390/zfcp/helps.rb b/src/include/s390/zfcp/helps.rb
index e53b4d8a..b37b5c44 100644
--- a/src/include/s390/zfcp/helps.rb
+++ b/src/include/s390/zfcp/helps.rb
@@ -37,7 +37,7 @@ def initialize_s390_zfcp_helps(_include_target)
# Read dialog help 2/2
_(
"Aborting Initialization:
\nSafely abort " \
- "the configuration utility by pressing Abort now.
"
+ "the configuration utility by pressing Abort now."
),
# Write dialog help 1/2
"write" => _(
@@ -46,8 +46,8 @@ def initialize_s390_zfcp_helps(_include_target)
# Write dialog help 2/2
_(
"Aborting Saving:
\n" \
- "Abort the save procedure by pressing Abort.\n" \
- "An additional dialog will inform you whether it is safe to do so.
\n"
+ "Abort the save procedure by pressing Abort.\n" \
+ "An additional dialog will inform you whether it is safe to do so.\n"
),
# Disk selection dialog help 1/3
"disk_selection" => _(
@@ -63,34 +63,34 @@ def initialize_s390_zfcp_helps(_include_target)
_("Warning
") +
_(
"When accessing a ZFCP device\n" \
- "READ/WRITE, make sure that this access is exclusive.\n" \
- "Otherwise there is a potential risk of data corruption.
"
+ "READ/WRITE, make sure that this access is exclusive.\n" \
+ "Otherwise there is a potential risk of data corruption."
),
# Disk add help 1/2
"disk_add" => _(
"Add New ZFCP Device
\n" \
- "Enter the identifier of the device to add, the\n" \
- "Channel ID of the ZFCP controller, the worldwide port number\n" \
- "(WWPN) and the LUN number.
\n"
+ "Enter the identifier of the device to add, the\n" \
+ "Channel ID of the ZFCP controller, the worldwide port number\n" \
+ "(WWPN) and the LUN number.\n"
) +
# Disk add help 2/2, This is HTML, so finally "<devno>" is displayed as ""
_(
"The Channel ID must be entered with lowercase letters in a sysfs conforming\n" \
- "format 0.0.<devno>, such as 0.0.5c51.
\n" \
- "The WWPN must be entered with lowercase letters as a 16-digit hex value, such as\n" \
- "0x5005076300c40e5a.
\n" \
- "The LUN must be entered with lowercase letters as a 16-digit hex value with\n" \
- "all trailing zeros, such as 0x52ca000000000000.
" \
- "If no WWPN and no LUN have been defined the system is " \
- "trying to use auto LUN scan. Auto LUN scan can be turned off using " \
- "the kernel parameter allow_lun_scan=0.
"
+ "format 0.0.<devno>, such as 0.0.5c51.\n" \
+ "The WWPN must be entered with lowercase letters as a 16-digit hex value, such as\n" \
+ "0x5005076300c40e5a.
\n" \
+ "The LUN must be entered with lowercase letters as a 16-digit hex value with\n" \
+ "all trailing zeros, such as 0x52ca000000000000.
" \
+ "If no WWPN and no LUN have been defined the system is " \
+ "trying to use auto LUN scan. Auto LUN scan can be turned off using " \
+ "the kernel parameter allow_lun_scan=0.
"
) +
# Disk selection dialog Warning
_("Warning
") +
_(
"When accessing a ZFCP device\n" \
- "READ/WRITE, make sure that this access is exclusive.\n" \
- "Otherwise there is a potential risk of data corruption.
"
+ "READ/WRITE, make sure that this access is exclusive.\n" \
+ "Otherwise there is a potential risk of data corruption."
)
}
end
diff --git a/src/lib/y2s390/dasd.rb b/src/lib/y2s390/dasd.rb
index 04eba92f..a8cf9a6c 100644
--- a/src/lib/y2s390/dasd.rb
+++ b/src/lib/y2s390/dasd.rb
@@ -138,7 +138,7 @@ def partition_info
return out if out.empty?
regexp = Regexp.new("^[ \t]*([^ \t]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)" \
- "[ \t]+([^ \t]+)[ \t]+([^ \t]+([ \t]+[^ \t]+))*[ \t]*$")
+ "[ \t]+([^ \t]+)[ \t]+([^ \t]+([ \t]+[^ \t]+))*[ \t]*$")
lines = out.split("\n").select { |s| s.match?(regexp) }
lines.map do |line|
diff --git a/src/lib/y2s390/dasd_actions/format.rb b/src/lib/y2s390/dasd_actions/format.rb
index 61db742a..cf79aeed 100644
--- a/src/lib/y2s390/dasd_actions/format.rb
+++ b/src/lib/y2s390/dasd_actions/format.rb
@@ -92,8 +92,8 @@ def really_format?
format(
_(
"Formatting these disks destroys all data on them.
\n" \
- "Really format the following disks?
\n" \
- "%s"
+ "Really format the following disks?
\n" \
+ "%s"
), channels_str
),
60,
diff --git a/src/lib/y2s390/dasds_collection.rb b/src/lib/y2s390/dasds_collection.rb
index 4f047956..f725dd14 100644
--- a/src/lib/y2s390/dasds_collection.rb
+++ b/src/lib/y2s390/dasds_collection.rb
@@ -57,7 +57,7 @@ def unformatted
#
# @return [DasdsCollection]
def to_format(format_unformatted: false)
- filter { |d| d.format_wanted || format_unformatted && !d.formatted? }
+ filter { |d| d.format_wanted || (format_unformatted && !d.formatted?) }
end
end
end
diff --git a/src/lib/y2s390/dasds_reader.rb b/src/lib/y2s390/dasds_reader.rb
index e1c41dd3..cf0a69d0 100644
--- a/src/lib/y2s390/dasds_reader.rb
+++ b/src/lib/y2s390/dasds_reader.rb
@@ -185,7 +185,7 @@ def partition_info(dasd)
return out if out.empty?
regexp = Regexp.new("^[ \t]*([^ \t]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)" \
- "[ \t]+([^ \t]+)[ \t]+([^ \t]+([ \t]+[^ \t]+))*[ \t]*$")
+ "[ \t]+([^ \t]+)[ \t]+([^ \t]+([ \t]+[^ \t]+))*[ \t]*$")
lines = out.split("\n").select { |s| s.match?(regexp) }
lines.map do |line|
diff --git a/src/lib/y2s390/format_process.rb b/src/lib/y2s390/format_process.rb
index 17230d45..3c2ceab4 100644
--- a/src/lib/y2s390/format_process.rb
+++ b/src/lib/y2s390/format_process.rb
@@ -24,6 +24,7 @@ module Y2S390
# This class is responsible for maintaining an specific DASD format progress
class FormatStatus
attr_accessor :progress, :cylinders, :dasd
+
# Constructor
#
# @param dasd [Dasd]
diff --git a/src/modules/IUCVTerminalServer.rb b/src/modules/IUCVTerminalServer.rb
index 45d60cd3..234bd205 100644
--- a/src/modules/IUCVTerminalServer.rb
+++ b/src/modules/IUCVTerminalServer.rb
@@ -173,7 +173,9 @@ def AddUser(username, password, group_id, home, shell, additional_groups, force_
# make sure that the user doesn't already exist
users = GetUsers(false)
- if !Builtins.haskey(users, username)
+ if Builtins.haskey(users, username)
+ Builtins.y2milestone("The user %1 does already exist.", username)
+ else
user = {
"uid" => username,
"loginShell" => shell,
@@ -202,8 +204,6 @@ def AddUser(username, password, group_id, home, shell, additional_groups, force_
error
)
end
- else
- Builtins.y2milestone("The user %1 does already exist.", username)
end
new_userid
end
@@ -249,7 +249,7 @@ def AddTsUser(username, password, home, additional_groups, force_pw_change)
group = Users.GetGroupByName("ts-shell", "system")
group_id = Ops.get_string(group, "gidNumber", "")
- new_uid = AddUser(
+ AddUser(
username,
password,
group_id,
@@ -258,8 +258,6 @@ def AddTsUser(username, password, home, additional_groups, force_pw_change)
additional_groups,
force_pw_change
)
-
- new_uid
end
# Update a configuration entry for TS-Shell users and configured groups
diff --git a/src/modules/OnPanic.rb b/src/modules/OnPanic.rb
index d10b9bc6..51864da3 100644
--- a/src/modules/OnPanic.rb
+++ b/src/modules/OnPanic.rb
@@ -130,15 +130,15 @@ def ConvertConfToMkdump(dev)
type = Ops.get_string(dev, "DUMP_TYPE")
Builtins.foreach(@dump_devices) do |entry|
line = Builtins.splitstring(entry, "\t")
- if type == "ccw" &&
+ if (type == "ccw" &&
Builtins.regexpmatch(Ops.get(line, 0), "^/dev/dasd[[:lower:]]+") &&
- Ops.get(line, 2) == Ops.get(dev, "DEVICE") ||
+ Ops.get(line, 2) == Ops.get(dev, "DEVICE")) ||
# check for fitting zfcp
- type == "fcp" &&
+ (type == "fcp" &&
Builtins.regexpmatch(Ops.get(line, 0), "^/dev/sd[[:lower:]]+") &&
Ops.get(line, 2) == Ops.get(dev, "DEVICE") &&
Ops.get(line, 3) == Ops.get(dev, "WWPN") &&
- Ops.get(line, 4) == Ops.get(dev, "LUN") # check for fitting dasd
+ Ops.get(line, 4) == Ops.get(dev, "LUN")) # check for fitting dasd
mkdump = entry
Builtins.y2milestone(
"In /etc/sysconfig/dumpconf configured dump device found: %1",
diff --git a/src/modules/Xpram.rb b/src/modules/Xpram.rb
index e590f93e..a4245430 100644
--- a/src/modules/Xpram.rb
+++ b/src/modules/Xpram.rb
@@ -127,9 +127,7 @@ def Write
bret = Service.Stop("xpram")
Builtins.y2milestone("Service::Stop (xpram) returns %1", bret)
- if !bret
- Report.Error(_("Error stopping xpram. Try \"rcxpram stop\" manually."))
- else
+ if bret
if @force
SCR.Write(path(".sysconfig.xpram.XPRAM_FORCE"), "yes")
else
@@ -154,6 +152,8 @@ def Write
end
Progress.NextStage
+ else
+ Report.Error(_("Error stopping xpram. Try \"rcxpram stop\" manually."))
end
true
end
diff --git a/src/modules/ZFCPController.rb b/src/modules/ZFCPController.rb
index 4f9d17ec..dd7f1373 100644
--- a/src/modules/ZFCPController.rb
+++ b/src/modules/ZFCPController.rb
@@ -154,20 +154,18 @@ def Write
end
end
- if !Mode.installation
- if @disk_configured
- # popup label
- UI.OpenDialog(Label(_("Running mkinitrd.")))
+ if !Mode.installation && @disk_configured
+ # popup label
+ UI.OpenDialog(Label(_("Running mkinitrd.")))
- command = "/sbin/mkinitrd"
- Builtins.y2milestone("Running command %1", command)
- ret = SCR.Execute(path(".target.bash"), command)
- Builtins.y2milestone("Exit code: %1", ret)
+ command = "/sbin/mkinitrd"
+ Builtins.y2milestone("Running command %1", command)
+ ret = SCR.Execute(path(".target.bash"), command)
+ Builtins.y2milestone("Exit code: %1", ret)
- UI.CloseDialog
+ UI.CloseDialog
- @disk_configured = false
- end
+ @disk_configured = false
end
true
@@ -308,7 +306,7 @@ def GetControllers
if zfcp.controllers.none? && !Arch.is_zkvm
# TRANSLATORS: warning message
Report.Warning(_("Cannot evaluate ZFCP controllers (e.g. in LPAR).\n" \
- "You will have to set it manually."))
+ "You will have to set it manually."))
end
Builtins.y2milestone("probed ZFCP controllers %1", zfcp.controllers)
@@ -522,10 +520,10 @@ def activate_controller(channel)
output = zfcp.activate_controller(channel)
exit_code = output["exit"]
- if exit_code != 0
- ReportControllerActivationError(channel, exit_code)
- else
+ if exit_code == 0
register_as_activated(channel)
+ else
+ ReportControllerActivationError(channel, exit_code)
end
end
diff --git a/test/dasd_dialogs_include_test.rb b/test/dasd_dialogs_include_test.rb
index 0ab38c1d..18aa62a4 100755
--- a/test/dasd_dialogs_include_test.rb
+++ b/test/dasd_dialogs_include_test.rb
@@ -2,7 +2,7 @@
require_relative "./test_helper"
-require_relative "../src/include/s390/dasd/dialogs.rb"
+require_relative "../src/include/s390/dasd/dialogs"
describe Yast::S390DasdDialogsInclude do
subject do
diff --git a/test/ui_include_test.rb b/test/ui_include_test.rb
index 90a7e805..1e4ac27d 100755
--- a/test/ui_include_test.rb
+++ b/test/ui_include_test.rb
@@ -2,7 +2,7 @@
require_relative "./test_helper"
-require_relative "../src/include/s390/dump/ui.rb"
+require_relative "../src/include/s390/dump/ui"
Yast.import "Wizard"
Yast.import "Dump"
diff --git a/test/ui_onpanic_include_test.rb b/test/ui_onpanic_include_test.rb
index 69efa0a7..dfc927f0 100755
--- a/test/ui_onpanic_include_test.rb
+++ b/test/ui_onpanic_include_test.rb
@@ -2,7 +2,7 @@
require_relative "./test_helper"
-require_relative "../src/include/s390/onpanic/ui.rb"
+require_relative "../src/include/s390/onpanic/ui"
Yast.import "Wizard"
Yast.import "OnPanic"
diff --git a/test/y2s390/dasd_actions/activate_test.rb b/test/y2s390/dasd_actions/activate_test.rb
index b21e31ac..56d9e0a1 100755
--- a/test/y2s390/dasd_actions/activate_test.rb
+++ b/test/y2s390/dasd_actions/activate_test.rb
@@ -19,7 +19,7 @@
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.
-require_relative "../../test_helper.rb"
+require_relative "../../test_helper"
require "y2s390/dasd_actions/activate"
describe Y2S390::DasdActions::Activate do
diff --git a/test/y2s390/dasd_actions/base_test.rb b/test/y2s390/dasd_actions/base_test.rb
index 75b02697..255e2b51 100755
--- a/test/y2s390/dasd_actions/base_test.rb
+++ b/test/y2s390/dasd_actions/base_test.rb
@@ -19,7 +19,7 @@
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.
-require_relative "../../test_helper.rb"
+require_relative "../../test_helper"
require "y2s390/dasd_actions/base"
describe Y2S390::DasdActions::Base do
diff --git a/test/y2s390/dasd_actions/deactivate_test.rb b/test/y2s390/dasd_actions/deactivate_test.rb
index 73367a34..136c5df5 100755
--- a/test/y2s390/dasd_actions/deactivate_test.rb
+++ b/test/y2s390/dasd_actions/deactivate_test.rb
@@ -19,7 +19,7 @@
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.
-require_relative "../../test_helper.rb"
+require_relative "../../test_helper"
require "y2s390/dasd_actions/deactivate"
describe Y2S390::DasdActions::Deactivate do
diff --git a/test/y2s390/dasd_actions/diag_test.rb b/test/y2s390/dasd_actions/diag_test.rb
index 839f8b04..e9f59435 100755
--- a/test/y2s390/dasd_actions/diag_test.rb
+++ b/test/y2s390/dasd_actions/diag_test.rb
@@ -19,7 +19,7 @@
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.
-require_relative "../../test_helper.rb"
+require_relative "../../test_helper"
require "y2s390/dasd_actions/diag"
describe Y2S390::DasdActions::DiagOn do
diff --git a/test/y2s390/dasd_actions/format_test.rb b/test/y2s390/dasd_actions/format_test.rb
index eac6e41f..f10b8cb8 100755
--- a/test/y2s390/dasd_actions/format_test.rb
+++ b/test/y2s390/dasd_actions/format_test.rb
@@ -19,7 +19,7 @@
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.
-require_relative "../../test_helper.rb"
+require_relative "../../test_helper"
require "y2s390/dasd_actions/format"
describe Y2S390::DasdActions::Format do
diff --git a/test/y2s390/dialogs/format_dialog_test.rb b/test/y2s390/dialogs/format_dialog_test.rb
index 67af2265..3ae72b72 100755
--- a/test/y2s390/dialogs/format_dialog_test.rb
+++ b/test/y2s390/dialogs/format_dialog_test.rb
@@ -19,7 +19,7 @@
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.
-require_relative "../../test_helper.rb"
+require_relative "../../test_helper"
require "y2s390"
require "y2s390/dialogs/format_dialog"
From d8ab2926f31c504e05a5f6e6a492449a7a266b4f Mon Sep 17 00:00:00 2001
From: Josef Reidinger
Date: Wed, 6 Mar 2024 22:12:19 +0100
Subject: [PATCH 2/3] new rubocop: autocorrection with -A
---
src/clients/dasd_proposal.rb | 9 ++++----
src/clients/s390-disk-controller.rb | 5 +++--
src/clients/zfcp_proposal.rb | 9 ++++----
src/include/s390/dasd/dialogs.rb | 5 +++--
src/include/s390/iucvterminal-server/ui.rb | 25 +++++++++++++---------
src/include/s390/iucvterminal/ui.rb | 7 +++---
src/include/s390/zfcp/dialogs.rb | 16 ++++++++------
src/lib/y2s390/dasd.rb | 2 +-
src/lib/y2s390/dasds_reader.rb | 8 +++----
src/modules/Dump.rb | 11 +++++-----
src/modules/IUCVTerminal.rb | 2 +-
src/modules/IUCVTerminalServer.rb | 7 +++---
12 files changed, 60 insertions(+), 46 deletions(-)
diff --git a/src/clients/dasd_proposal.rb b/src/clients/dasd_proposal.rb
index e8a9f2d2..6f7df67b 100644
--- a/src/clients/dasd_proposal.rb
+++ b/src/clients/dasd_proposal.rb
@@ -40,7 +40,8 @@ def main
@ret = {}
# Make proposal for installation/configuration...
- if @func == "MakeProposal"
+ case @func
+ when "MakeProposal"
@summary = DASDController.Summary
if Builtins.isempty(@summary)
# text for installation summary
@@ -53,7 +54,7 @@ def main
"warning_level" => nil
}
# Run an interactive workflow
- elsif @func == "AskUser"
+ when "AskUser"
Wizard.CreateDialog
storage = Y2Storage::StorageManager.instance
# Deactivate high level devices (RAID, multipath, LVM, encryption...)
@@ -68,7 +69,7 @@ def main
# Fill return map
@ret = { "workflow_sequence" => @sequence }
# Return human readable titles for the proposal
- elsif @func == "Description"
+ when "Description"
return nil if !DASDController.IsAvailable
# Fill return map
@@ -82,7 +83,7 @@ def main
),
"id" => "dasd"
}
- elsif @func == "Write"
+ when "Write"
DASDController.Write
end
diff --git a/src/clients/s390-disk-controller.rb b/src/clients/s390-disk-controller.rb
index 093195ca..95b6f4d2 100644
--- a/src/clients/s390-disk-controller.rb
+++ b/src/clients/s390-disk-controller.rb
@@ -113,10 +113,11 @@ def main
@ret = nil
while @ret.nil?
@ret = UI.UserInput
- if @ret == :dasd
+ case @ret
+ when :dasd
WFM.call("dasd")
@ret = nil
- elsif @ret == :zfcp
+ when :zfcp
WFM.call("zfcp")
@ret = nil
end
diff --git a/src/clients/zfcp_proposal.rb b/src/clients/zfcp_proposal.rb
index d73fec3c..7745462b 100644
--- a/src/clients/zfcp_proposal.rb
+++ b/src/clients/zfcp_proposal.rb
@@ -40,7 +40,8 @@ def main
@ret = {}
# Make proposal for installation/configuration...
- if @func == "MakeProposal"
+ case @func
+ when "MakeProposal"
@summary = ZFCPController.Summary
if Builtins.isempty(@summary)
# text for installation summary
@@ -53,7 +54,7 @@ def main
"warning_level" => nil
}
# Run an interactive workflow
- elsif @func == "AskUser"
+ when "AskUser"
Wizard.CreateDialog
storage = Y2Storage::StorageManager.instance
# Deactivate high level devices (RAID, multipath, LVM, encryption...)
@@ -68,7 +69,7 @@ def main
# Fill return map
@ret = { "workflow_sequence" => @sequence }
# Return human readable titles for the proposal
- elsif @func == "Description"
+ when "Description"
return nil if !ZFCPController.IsAvailable
# Fill return map
@@ -82,7 +83,7 @@ def main
),
"id" => "zfcp"
}
- elsif @func == "Write"
+ when "Write"
ZFCPController.Write
end
diff --git a/src/include/s390/dasd/dialogs.rb b/src/include/s390/dasd/dialogs.rb
index 6c1e3840..6964cc43 100644
--- a/src/include/s390/dasd/dialogs.rb
+++ b/src/include/s390/dasd/dialogs.rb
@@ -383,7 +383,8 @@ def AddDASDDiskDialog
while ret.nil?
ret = Convert.to_symbol(UI.UserInput)
- if ret == :abort || ret == :cancel
+ case ret
+ when :abort, :cancel
# yes-no popup
if !Popup.YesNo(
_(
@@ -392,7 +393,7 @@ def AddDASDDiskDialog
)
ret = nil
end
- elsif ret == :next
+ when :next
channel = Convert.to_string(UI.QueryWidget(Id(:channel), :Value))
if !DASDController.IsValidChannel(channel)
diff --git a/src/include/s390/iucvterminal-server/ui.rb b/src/include/s390/iucvterminal-server/ui.rb
index b1904939..95795389 100644
--- a/src/include/s390/iucvterminal-server/ui.rb
+++ b/src/include/s390/iucvterminal-server/ui.rb
@@ -577,9 +577,10 @@ def TsGroupDialogContent
def MainDialogContent
# draw active tab
- widgets = if @current_main_tab == :t_zvmids
+ widgets = case @current_main_tab
+ when :t_zvmids
ZvmIdsDialogContent()
- elsif @current_main_tab == :t_tsshell
+ when :t_tsshell
TsShellDialogContent()
else
IucvConnDialogContent()
@@ -605,13 +606,14 @@ def MainDialogContent
def InitMainDialog(tab)
# remember current tab
@current_main_tab = tab
- if tab == :t_zvmids
+ case tab
+ when :t_zvmids
UI.ChangeWidget(
Id(:zvmids),
:Value,
Builtins.mergestring(@zvm_id_list, "\n")
)
- elsif tab == :t_tsshell
+ when :t_tsshell
# disable frames if TS-Shell is disabled
HandleEvent(:ts_enabled)
@@ -1442,19 +1444,21 @@ def HandleEvent(widget)
end
# tab handling
- if widget == :t_zvmids
+ case widget
+ when :t_zvmids
# SaveSettings( $[ "ID" : widget ] );
UI.ReplaceWidget(Id(:tab_content), ZvmIdsDialogContent())
InitMainDialog(widget)
Wizard.SetHelpText(Ops.get_string(@HELP, "zvmids", ""))
- elsif widget == :t_tsshell || widget == :t_iucvconn
+ when :t_tsshell, :t_iucvconn
# deactivate other tabs without valid z/VM ids
if Ops.greater_than(Builtins.size(@zvm_id_list), 0)
- if widget == :t_tsshell
+ case widget
+ when :t_tsshell
UI.ReplaceWidget(Id(:tab_content), TsShellDialogContent())
InitMainDialog(widget)
Wizard.SetHelpText(Ops.get_string(@HELP, "ts", ""))
- elsif widget == :t_iucvconn
+ when :t_iucvconn
UI.ReplaceWidget(Id(:tab_content), IucvConnDialogContent())
InitMainDialog(widget)
Wizard.SetHelpText(Ops.get_string(@HELP, "ic", ""))
@@ -1504,10 +1508,11 @@ def IUCVTerminalServerDialog
ret = :again
success = true
# check TS-Shell user dialog settings and commit them if valid
- if @current_dialog == :ts_open_user_dialog
+ case @current_dialog
+ when :ts_open_user_dialog
success = CommitTsUserDialogSettings()
# commit TS-Shell group dialog settings
- elsif @current_dialog == :ts_open_group_dialog
+ when :ts_open_group_dialog
CommitTsGroupDialogSettings()
end
diff --git a/src/include/s390/iucvterminal/ui.rb b/src/include/s390/iucvterminal/ui.rb
index bdcf2c67..4afaa371 100644
--- a/src/include/s390/iucvterminal/ui.rb
+++ b/src/include/s390/iucvterminal/ui.rb
@@ -48,15 +48,16 @@ def IsValidTerminalSrvList
ret = false
restrict_hvc_to_srvs = UI.QueryWidget(Id(:restrict_hvc_to_srvs), :Value)
- if restrict_hvc_to_srvs =~ /[^[[:lower:]][[:digit:]],]/
+ case restrict_hvc_to_srvs
+ when /[^[[:lower:]][[:digit:]],]/
Popup.Notify(
_(
"Wrong input, only lower case letters, numbers and for separation commas are allowed."
)
)
- elsif restrict_hvc_to_srvs =~ /^,|,,/
+ when /^,|,,/
Popup.Notify(_("Comma is only a separator."))
- elsif restrict_hvc_to_srvs =~ /[[[:lower:]][[:digit:]]]{9,}/
+ when /[[[:lower:]][[:digit:]]]{9,}/
Popup.Notify(_("z/VM IDs do not allow more than eight characters."))
else
ret = true
diff --git a/src/include/s390/zfcp/dialogs.rb b/src/include/s390/zfcp/dialogs.rb
index 0825c601..15ed7a13 100644
--- a/src/include/s390/zfcp/dialogs.rb
+++ b/src/include/s390/zfcp/dialogs.rb
@@ -199,7 +199,8 @@ def ZFCPDialog
while ret.nil?
ret = Convert.to_symbol(UI.UserInput)
- if ret == :filter
+ case ret
+ when :filter
filter_min = Convert.to_string(UI.QueryWidget(:min_chan, :Value))
filter_max = Convert.to_string(UI.QueryWidget(:max_chan, :Value))
@@ -217,10 +218,10 @@ def ZFCPDialog
ReloadZFCPDialog()
ret = nil
next
- elsif ret == :table
+ when :table
ret = nil
next
- elsif ret == :abort || ret == :cancel
+ when :abort, :cancel
# yes-no popup
if !Popup.YesNo(
_(
@@ -326,7 +327,8 @@ def AddZFCPDiskDialog
while ret.nil?
ret = Convert.to_symbol(UI.UserInput)
- if ret == :get_wwpn
+ case ret
+ when :get_wwpn
channel = Convert.to_string(UI.QueryWidget(:channel, :Value))
if !ZFCPController.IsValidChannel(channel)
@@ -342,7 +344,7 @@ def AddZFCPDiskDialog
wwpns = ZFCPController.GetWWPNs(channel)
UI.ChangeWidget(:wwpn, :Items, wwpns)
ret = nil
- elsif ret == :get_lun
+ when :get_lun
channel = Convert.to_string(UI.QueryWidget(:channel, :Value))
wwpn = Convert.to_string(UI.QueryWidget(:wwpn, :Value))
@@ -368,7 +370,7 @@ def AddZFCPDiskDialog
luns = ZFCPController.GetLUNs(channel, wwpn)
UI.ChangeWidget(:lun, :Items, luns)
ret = nil
- elsif ret == :abort || ret == :cancel
+ when :abort, :cancel
# yes-no popup
if !Popup.YesNo(
_(
@@ -377,7 +379,7 @@ def AddZFCPDiskDialog
)
ret = nil
end
- elsif ret == :next
+ when :next
channel = Convert.to_string(UI.QueryWidget(Id(:channel), :Value))
wwpn = Convert.to_string(UI.QueryWidget(Id(:wwpn), :Value))
lun = Convert.to_string(UI.QueryWidget(Id(:lun), :Value))
diff --git a/src/lib/y2s390/dasd.rb b/src/lib/y2s390/dasd.rb
index a8cf9a6c..061dcfc4 100644
--- a/src/lib/y2s390/dasd.rb
+++ b/src/lib/y2s390/dasd.rb
@@ -140,7 +140,7 @@ def partition_info
regexp = Regexp.new("^[ \t]*([^ \t]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)" \
"[ \t]+([^ \t]+)[ \t]+([^ \t]+([ \t]+[^ \t]+))*[ \t]*$")
- lines = out.split("\n").select { |s| s.match?(regexp) }
+ lines = out.split("\n").grep(regexp)
lines.map do |line|
r = line.match(regexp)
"#{r[1]} (#{r[6]})"
diff --git a/src/lib/y2s390/dasds_reader.rb b/src/lib/y2s390/dasds_reader.rb
index cf0a69d0..ee682179 100644
--- a/src/lib/y2s390/dasds_reader.rb
+++ b/src/lib/y2s390/dasds_reader.rb
@@ -46,7 +46,7 @@ def list(offline: true, force_probing: false)
a = dasd_entries(offline: offline).each_with_object([]) do |entry, arr|
next unless entry.start_with?(/\d/)
- id, status, name, _, type, = entry.split(" ")
+ id, status, name, _, type, = entry.split
attrs = Yast::Mode.config ? {} : { status: status, device_name: name, type: type }
dasd = Y2S390::Dasd.new(id, **attrs).tap do |d|
if Yast::Mode.config
@@ -71,7 +71,7 @@ def refresh_data!(dasds)
dasd_entries(offline: true).each do |entry|
next unless entry.start_with?(/\d/)
- id, status, name, _, type, = entry.split(" ")
+ id, status, name, _, type, = entry.split
dasd = dasds.by_id(id)
next unless dasd
@@ -92,7 +92,7 @@ def update_info(dasd, extended: false)
data = dasd_entries(dasd: dasd).find { |e| e.start_with?(/\d/) }
return false if data.to_s.empty?
- _, status, name, _, type, = data.split(" ")
+ _, status, name, _, type, = data.split
dasd.status = status
dasd.device_name = name
dasd.type = type
@@ -187,7 +187,7 @@ def partition_info(dasd)
regexp = Regexp.new("^[ \t]*([^ \t]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)" \
"[ \t]+([^ \t]+)[ \t]+([^ \t]+([ \t]+[^ \t]+))*[ \t]*$")
- lines = out.split("\n").select { |s| s.match?(regexp) }
+ lines = out.split("\n").grep(regexp)
lines.map do |line|
r = line.match(regexp)
"#{r[1]} (#{r[6]})"
diff --git a/src/modules/Dump.rb b/src/modules/Dump.rb
index b214ad54..7e01a209 100644
--- a/src/modules/Dump.rb
+++ b/src/modules/Dump.rb
@@ -138,21 +138,22 @@ def FormatDisk(dev, force)
Progress.NextStage
if ret != 0
- err = if ret == 11
+ err = case ret
+ when 11
# error description
_("Invalid or unusable disk (fatal).")
- elsif ret == 12
+ when 12
# error description
_(
"Incompatible formatting or partitioning, correct with Force."
)
- elsif ret == 13
+ when 13
# error description
_("Missing support programs.")
- elsif ret == 14
+ when 14
# error description
_("Missing or wrong parameters.")
- elsif ret == 15
+ when 15
# error description
_("Access problem.")
else
diff --git a/src/modules/IUCVTerminal.rb b/src/modules/IUCVTerminal.rb
index 4bdbba74..dac10afe 100644
--- a/src/modules/IUCVTerminal.rb
+++ b/src/modules/IUCVTerminal.rb
@@ -74,7 +74,7 @@ def main
end
def tty_entries(prefix)
- Dir.entries(@getty_conf_dir).select { |e| e =~ /^#{prefix}@.+\.service$/ }
+ Dir.entries(@getty_conf_dir).grep(/^#{prefix}@.+\.service$/)
end
def get_tty_num(prefix)
diff --git a/src/modules/IUCVTerminalServer.rb b/src/modules/IUCVTerminalServer.rb
index 234bd205..04cdf896 100644
--- a/src/modules/IUCVTerminalServer.rb
+++ b/src/modules/IUCVTerminalServer.rb
@@ -514,16 +514,17 @@ def Write
value = ""
type = Ops.get_symbol(entries, :type)
# Manual selection
- if type == :rb_ts_list
+ case type
+ when :rb_ts_list
selected_ids = Ops.get_list(entries, type, [])
# remove the TEXT_ALL entry because it is not supported by the configuration
selected_ids = Builtins.remove(selected_ids, 0) if Ops.get(selected_ids, 0, "") == @TEXT_ALL
value = Ops.add("list:", Builtins.mergestring(selected_ids, ","))
# Regex
- elsif type == :rb_ts_regex
+ when :rb_ts_regex
value = Ops.add("regex:", Ops.get_string(entries, type, ""))
# File
- elsif type == :rb_ts_file
+ when :rb_ts_file
value = Ops.add("file:", Ops.get_string(entries, type, ""))
end
# ignore empty entries(like "list:" or "regex:")
From 42e3a6bf8e4bdc74910dc683bd633a63c3511ada Mon Sep 17 00:00:00 2001
From: Josef Reidinger
Date: Wed, 6 Mar 2024 22:16:52 +0100
Subject: [PATCH 3/3] new rubocop: manual fixes
---
src/lib/y2s390/dialogs/format_dialog.rb | 2 ++
test/y2s390/dialogs/format_dialog_test.rb | 2 ++
2 files changed, 4 insertions(+)
diff --git a/src/lib/y2s390/dialogs/format_dialog.rb b/src/lib/y2s390/dialogs/format_dialog.rb
index 3fca2061..86d1c2f4 100644
--- a/src/lib/y2s390/dialogs/format_dialog.rb
+++ b/src/lib/y2s390/dialogs/format_dialog.rb
@@ -43,6 +43,8 @@ class FormatDialog < ::UI::Dialog
#
# @param dasds [Array] list of DASDs to be formatted
def initialize(dasds)
+ super()
+
textdomain "s390"
@dasds = dasds
@fmt_process = FormatProcess.new(dasds)
diff --git a/test/y2s390/dialogs/format_dialog_test.rb b/test/y2s390/dialogs/format_dialog_test.rb
index 3ae72b72..1ec9349a 100755
--- a/test/y2s390/dialogs/format_dialog_test.rb
+++ b/test/y2s390/dialogs/format_dialog_test.rb
@@ -84,6 +84,7 @@ def mock_ui_events(*events)
context "when the process is not running after 0.2 seconds of waiting" do
before do
allow(fmt_process).to receive(:running?).and_return(false)
+ allow(subject).to receive(:report_format_failed)
end
it "reports a format failed error" do
@@ -93,6 +94,7 @@ def mock_ui_events(*events)
end
it "returns nil" do
+ expect(subject.run).to eq nil
end
end