Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New rubocop #112

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions src/clients/dasd_proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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...)
Expand All @@ -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
Expand All @@ -82,7 +83,7 @@ def main
),
"id" => "dasd"
}
elsif @func == "Write"
when "Write"
DASDController.Write
end

Expand Down
5 changes: 3 additions & 2 deletions src/clients/s390-disk-controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions src/clients/zfcp_proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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...)
Expand All @@ -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
Expand All @@ -82,7 +83,7 @@ def main
),
"id" => "zfcp"
}
elsif @func == "Write"
when "Write"
ZFCPController.Write
end

Expand Down
25 changes: 13 additions & 12 deletions src/include/s390/dasd/dialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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(
_(
Expand All @@ -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)
Expand Down
24 changes: 12 additions & 12 deletions src/include/s390/dasd/helps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def initialize_s390_dasd_helps(_include_target)
# Read dialog help 2/2
_(
"<p><b><big>Aborting Initialization:</big></b><br>\nSafely abort the " \
"configuration utility by pressing <b>Abort</b> now.</p>"
"configuration utility by pressing <b>Abort</b> now.</p>"
),
# Write dialog help 1/2
"write" => _(
Expand All @@ -46,18 +46,18 @@ def initialize_s390_dasd_helps(_include_target)
# Write dialog help 2/2
_(
"<p><b><big>Aborting Saving:</big></b><br>\n" \
"Abort the save procedure by pressing <b>Abort</b>.\n" \
"An additional dialog will inform you whether it is safe to do so.</p>\n"
"Abort the save procedure by pressing <b>Abort</b>.\n" \
"An additional dialog will inform you whether it is safe to do so.</p>\n"
),
# Disk selection dialog help 1/4
"disk_selection_config" => _(
"<p><b><big>Configured DASD Disks</big></b><br>\nIn this dialog, manage DASD " \
"disks on your system.</p>"
"disks on your system.</p>"
) +
# Disk selection dialog help 2/4
_(
"<p>To filter the displayed disks, set the <b>Minimum Channel ID</b> and \n" \
"the <b>Maximum Channel ID</b> and click <b>Filter</b>.</p>\n"
"the <b>Maximum Channel ID</b> and click <b>Filter</b>.</p>\n"
) +
# Disk selection dialog help 4/4
_("<p>To configure a new DASD disk, click <b>Add</b>.</p>") +
Expand All @@ -68,29 +68,29 @@ def initialize_s390_dasd_helps(_include_target)
# Disk selection dialog help 1/4
"disk_selection" => _(
"<p><b><big>Configured DASD Disks</big></b><br>\nIn this dialog, manage DASD disks " \
"on your system.</p>"
"on your system.</p>"
) +
# Disk selection dialog help 2/4
_(
"<p>To filter the displayed disks, set the <b>Minimum Channel ID</b> and \n" \
"the <b>Maximum Channel ID</b> and click <b>Filter</b>.</p>\n"
"the <b>Maximum Channel ID</b> and click <b>Filter</b>.</p>\n"
) +
# Disk selection dialog help 3/4
_(
"<p>To perform actions on multiple disks at once, mark these disks. To select " \
"all displayed disk (possibly after applying a filter), click\n<b>Select All</b> " \
"or <b>Deselect All</b>.</p>\n"
"all displayed disk (possibly after applying a filter), click\n<b>Select All</b> " \
"or <b>Deselect All</b>.</p>\n"
) +
# Disk selection dialog help 4/4
_(
"<p>To perform an action on the selected disks, use <b>Perform Action</b>.\n" \
"The action will be performed immediately!</p>"
"The action will be performed immediately!</p>"
),
# Disk add help 1/3
"disk_add_config" => _(
"<p><b><big>Add New DASD Disk</big></b><br>\n" \
"To add a disk, enter the <b>Channel ID</b> of the DASD disk as\n" \
"identifier.</p>"
"To add a disk, enter the <b>Channel ID</b> of the DASD disk as\n" \
"identifier.</p>"
) +
# Disk add help 1/3
_(
Expand Down
12 changes: 6 additions & 6 deletions src/include/s390/dump/ui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 <b>Force overwrite of disk</b>.</p>"
"formatted or partitioned, activate the checkbox <b>Force overwrite of disk</b>.</p>"
) +
# Dump dialog help 4/8
_(
Expand All @@ -68,7 +68,7 @@ def DumpDialog
# Dump dialog help 6/8
_(
"<p><b>dumpdevice</b> after a disk indicates that it is a usable dump\ndevice. " \
"Multi-volume dump devices are indicated by a list of DASD IDs.</p>"
"Multi-volume dump devices are indicated by a list of DASD IDs.</p>"
) +
# Dump dialog help 7/8
_("<p>ZFCP columns: Device, Size, ID, WWPN, LUN, Dump<br>") +
Expand Down Expand Up @@ -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
Expand All @@ -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
)
Expand Down
32 changes: 16 additions & 16 deletions src/include/s390/iucvterminal-server/helps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,31 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
) +
_(
"<p>To configure the IUCV terminal server, specify the z/VM IDs to be used.\n<br>" \
"They are separated by line breaks.</p>\n"
"They are separated by line breaks.</p>\n"
),
# TS-Shell dialog help 1/5
"ts" => _(
"<p><b><big>TS-Shell</big></b></p>"
) +
_(
"<p>TS-Shell allows to specify <b>Authorization</b> for every TS-Shell user and group. " \
"The rights of a group are inherited by its members.</p>"
"The rights of a group are inherited by its members.</p>"
) +
# TS-Shell dialog help 2/5
_(
"<p>Each allowed z/VM ID can be selected manually under <b>Selection</b>, defined by " \
"a <b>Regex</b> or loaded from a <b>File</b> which contains all allowed z/VM IDs " \
"separated by line breaks.</p>"
"a <b>Regex</b> or loaded from a <b>File</b> which contains all allowed z/VM IDs " \
"separated by line breaks.</p>"
) +
# TS-Shell dialog help 3/5
_(
"<p>Click on <b>New User</b> to create new TS-Shell users or <b>Delete\nUser</b> " \
"to remove users.</p>"
"to remove users.</p>"
) +
# TS-Shell dialog help 4/5
_(
"<p>To add or remove groups from the TS-Shell authorization table or to change\n" \
"the membership of users, go to <b>Manage Groups</b>.</p>"
"the membership of users, go to <b>Manage Groups</b>.</p>"
) +
# TS-Shell dialog help 5/5
_(
Expand All @@ -72,8 +72,8 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
) +
_(
"<p>To create new TS-Shell user the <b>Username</b>, <b>Home Directory</b> and " \
"<b>Password</b> has to be provided.\n\t<br>It is also possible to specify " \
"<b>Additional Groups</b> by selecting them on the right.</p>"
"<b>Password</b> has to be provided.\n\t<br>It is also possible to specify " \
"<b>Additional Groups</b> by selecting them on the right.</p>"
) +
# TS-Shell User creation dialog help 2/3
_(
Expand All @@ -83,21 +83,21 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
# TS-Shell User creation dialog help 3/3
_(
"<p>You can specify the same home directory for every TS-Shell user since no\n" \
"data will be stored there.</p>"
"data will be stored there.</p>"
),
# TS-Shell Managing Groups dialog help 1/5
"ts-group" => _(
"<p><b><big>Manage Groups for TS-Authorization</big></b></p>"
) +
_(
"<p>Define TS-Shell authorizations per group if you want every TS-Shell \n" \
"member of this groups to inherit the same rights.</p>"
"member of this groups to inherit the same rights.</p>"
) +
# TS-Shell Managing Groups dialog help 2/5
_(
"<p>Existing groups can be added to or removed from the TS-Shell\n" \
"authorization. Select the groups in the table and click on <b>Select or Deselect</b>. " \
"The current status is shown in the column <b>TS-Auth</b>.</p>"
"authorization. Select the groups in the table and click on <b>Select or Deselect</b>. " \
"The current status is shown in the column <b>TS-Auth</b>.</p>"
) +
# TS-Shell Managing Groups dialog help 3/5
_(
Expand All @@ -106,8 +106,8 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
# TS-Shell Managing Groups dialog help 4/5
_(
"<p>New groups could be created by entering the name in the <b>New Group</b> input field " \
"and confirming with <b>Create</b>.\n\t<br>To delete previously created groups the " \
"<b>YaST users</b> dialog has to be used.</p>"
"and confirming with <b>Create</b>.\n\t<br>To delete previously created groups the " \
"<b>YaST users</b> dialog has to be used.</p>"
) +
# TS-Shell Managing Groups dialog help 5/5
_(
Expand All @@ -119,12 +119,12 @@ def initialize_s390_iucvterminal_server_helps(_include_target)
) +
_(
"<p>IUCVConn on Login needs one user for every z/VM ID. To create these users " \
"a <b>password</b> and <b>home directory</b> has to be provided."
"a <b>password</b> and <b>home directory</b> has to be provided."
) +
# IUCVConn on Login dialog help 2/2
_(
"<p>It is possible to sync the users manually by clicking on <b>Sync</b> or just " \
"confirming the changes with <b>Ok</b> while <b>IUCVConn on Login</b> is enabled. </p>"
"confirming the changes with <b>Ok</b> while <b>IUCVConn on Login</b> is enabled. </p>"
)
}
# EOF
Expand Down
Loading
Loading