Skip to content

Commit

Permalink
Merge pull request #194 from yast/rubocop_update
Browse files Browse the repository at this point in the history
Rubocop update
  • Loading branch information
jreidinger authored Dec 22, 2023
2 parents 859a38f + 98ee3e4 commit b3e78e0
Show file tree
Hide file tree
Showing 13 changed files with 187 additions and 186 deletions.
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

# this needs more testing if we can have frozen string literals
Style/FrozenStringLiteralComment:
Expand All @@ -18,7 +18,7 @@ Lint/UnderscorePrefixedVariableName:

# Offense count: 25
Metrics/AbcSize:
Max: 190
Max: 200

# Offense count: 23
# Configuration parameters: CountComments, ExcludedMethods.
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ end
# additionally validate the control XML files as a part of the unit tests
task "test:unit" do
sh "xmllint --noout --relaxng #{Packaging::Configuration::YAST_DIR.shellescape}"\
"/control/control.rng control/*.xml"
"/control/control.rng control/*.xml"
end
7 changes: 4 additions & 3 deletions src/clients/backup_proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def main
@param = Convert.to_map(WFM.Args(1))
@ret = {}

if @func == "MakeProposal"
case @func
when "MakeProposal"
@force_reset = Ops.get_boolean(@param, "force_reset", false)
@language_changed = Ops.get_boolean(@param, "language_changed", false)

Expand Down Expand Up @@ -81,7 +82,7 @@ def main
end

@ret = { "preformatted_proposal" => HTML.List(@tmp) }
elsif @func == "AskUser"
when "AskUser"
@has_next = Ops.get_boolean(@param, "has_next", false)

# call some function that displays a user dialog
Expand All @@ -96,7 +97,7 @@ def main
# Fill return map

@ret = { "workflow_sequence" => @result }
elsif @func == "Description"
when "Description"
# Fill return map.
#
# Static values do just nicely here, no need to call a function.
Expand Down
16 changes: 8 additions & 8 deletions src/clients/inst_backup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ def main
# TRANSLATORS: help text for backup dialog during update 1/7
@help_text = _(
"<p>To avoid any loss of information during update,\n" \
"create a <b>backup</b> prior to updating.</p>\n"
"create a <b>backup</b> prior to updating.</p>\n"
)

# TRANSLATORS: help text for backup dialog during update 2/7
@help_text = Ops.add(
@help_text,
_(
"<p><b>Warning:</b> This will not be a complete\n" \
"backup. Only modified files will be saved.</p>\n"
"backup. Only modified files will be saved.</p>\n"
)
)

Expand All @@ -110,7 +110,7 @@ def main
@help_text,
_(
"<p><b>Create a Backup of Modified Files:</b>\n" \
"Stores only those modified files that will be replaced during update.</p>\n"
"Stores only those modified files that will be replaced during update.</p>\n"
)
)

Expand All @@ -119,8 +119,8 @@ def main
@help_text,
_(
"<p><b>Create a Complete Backup of\n" \
"/etc/sysconfig:</b> This covers all configuration files that are part of the\n" \
"sysconfig mechanism, even those that will not be replaced.</p>\n"
"/etc/sysconfig:</b> This covers all configuration files that are part of the\n" \
"sysconfig mechanism, even those that will not be replaced.</p>\n"
)
)

Expand All @@ -129,9 +129,9 @@ def main
@help_text,
_(
"<p><b>Remove Old Backups from the Backup\n" \
"Directory:</b> If your current system already is the result of an earlier\n" \
"update, there may be old configuration file backups. Select this option to\n" \
"remove them.</p>\n"
"Directory:</b> If your current system already is the result of an earlier\n" \
"update, there may be old configuration file backups. Select this option to\n" \
"remove them.</p>\n"
)
)

Expand Down
9 changes: 5 additions & 4 deletions src/clients/packages_proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def main
@param = Convert.to_map(WFM.Args(1))
@ret = {}

if @func == "MakeProposal"
case @func
when "MakeProposal"
@force_reset = Ops.get_boolean(@param, "force_reset", false)
@language_changed = Ops.get_boolean(@param, "language_changed", false)

Expand Down Expand Up @@ -188,7 +189,7 @@ def main
ret_ref = arg_ref(@ret)
Packages.CheckOldAddOns(ret_ref)
@ret = ret_ref.value
elsif @func == "AskUser"
when "AskUser"
@has_next = Ops.get_boolean(@param, "has_next", false)

# call some function that displays a user dialog
Expand All @@ -202,7 +203,7 @@ def main

# Fill return map
@ret = { "workflow_sequence" => @result }
elsif @func == "Description"
when "Description"
# Fill return map.
#
# Static values do just nicely here, no need to call a function.
Expand Down Expand Up @@ -288,7 +289,7 @@ def orphaned_packages_summary(packages)

if packages.size > ORPHANED_MAX_SIZE
# TRANSLATORS: %s is replaced by a number of remaining items
summary << _("... and %s more") % (packages.size - ORPHANED_MAX_SIZE)
summary << (_("... and %s more") % (packages.size - ORPHANED_MAX_SIZE))
end

summary
Expand Down
7 changes: 4 additions & 3 deletions src/clients/rootpart_proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def main
@param = Convert.to_map(WFM.Args(1))
@ret = {}

if @func == "MakeProposal"
case @func
when "MakeProposal"
@force_reset = Ops.get_boolean(@param, "force_reset", false)
@language_changed = Ops.get_boolean(@param, "language_changed", false)

Expand Down Expand Up @@ -113,7 +114,7 @@ def main
@ret = Builtins.add(@ret, "raw_proposal", [])
end
end
elsif @func == "AskUser"
when "AskUser"
@has_next = Ops.get_boolean(@param, "has_next", false)

# call some function that displays a user dialog
Expand All @@ -138,7 +139,7 @@ def main
"workflow_sequence" => @result,
"rootpart_changed" => RootPart.selectedRootPartition != @tmp
}
elsif @func == "Description"
when "Description"
# Fill return map.

@ret = if Mode.normal
Expand Down
36 changes: 19 additions & 17 deletions src/clients/update_proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def main

@rpm_db_existency_checked_already = false

if @func == "MakeProposal"
case @func
when "MakeProposal"
@force_reset = Ops.get_boolean(@param, "force_reset", false)
@language_changed = Ops.get_boolean(@param, "language_changed", false)

Expand Down Expand Up @@ -147,9 +148,9 @@ def main
# %2 is the version being installed
_(
"Updating system to another version (%1 -> %2) is not supported on " \
"the running system.<br>\n" \
"Boot from the installation media and use a normal upgrade\n" \
"or disable software repositories of products with different versions.\n"
"the running system.<br>\n" \
"Boot from the installation media and use a normal upgrade\n" \
"or disable software repositories of products with different versions.\n"
),
@update_from,
@update_to
Expand Down Expand Up @@ -196,9 +197,9 @@ def main
# TRANSLATORS: proposal dialog help
@update_options_help = _(
"<p><b><big>Update Options</big></b> Select how your system will be updated.\n" \
"Choose if only installed packages should be updated or new ones should be\n" \
"installed as well (default). Decide whether unmaintained packages should be\n" \
"deleted.</p>\n"
"Choose if only installed packages should be updated or new ones should be\n" \
"installed as well (default). Decide whether unmaintained packages should be\n" \
"deleted.</p>\n"
)

@ret = {
Expand All @@ -218,12 +219,12 @@ def main
end
# save the solver test case with details for later debugging
Pkg.CreateSolverTestCase("/var/log/YaST2/solver-upgrade-proposal") if @ret["warning"]
elsif @func == "AskUser"
when "AskUser"
# With proper control file, this should never be reached
# TRANSLATORS: error message
Report.Error(_("The update summary is read only and cannot be changed."))
@ret = { "workflow_sequence" => :back }
elsif @func == "Description"
when "Description"
# Fill return map.
#
# Static values do just nicely here, no need to call a function.
Expand Down Expand Up @@ -363,11 +364,12 @@ def CheckRPMDBforExistency

ui_r = UI.UserInput

if ui_r == :cancel || ui_r == :abort
case ui_r
when :cancel, :abort
ret = false
file_found_or_error_skipped = true
Builtins.y2milestone("Check failed, returning error.")
elsif ui_r == :retry
when :retry
file_found_or_error_skipped = false
Builtins.y2milestone("Trying again...")
# } else if (ui_r == `ignore) {
Expand Down Expand Up @@ -474,19 +476,19 @@ def init_stuff
Update.solve_errors = Pkg.PkgSolve(false) ? 0 : Pkg.PkgSolveErrors

log.info "Update compatibility: " \
"Update.ProductsCompatible: #{Update.ProductsCompatible}, " \
"Update.products_incompatible: #{Update.products_incompatible}, " \
"update_not_possible: #{update_not_possible}"
"Update.ProductsCompatible: #{Update.ProductsCompatible}, " \
"Update.products_incompatible: #{Update.products_incompatible}, " \
"update_not_possible: #{update_not_possible}"

# check product compatibility
if !(Update.ProductsCompatible || Update.products_incompatible) || update_not_possible
if Popup.ContinueCancel(
# TRANSLATORS: continue-cancel popup
_(
"The installed product is not compatible with the product\n" \
"on the installation media. If you try to update using the\n" \
"current installation media, the system may not start or\n" \
"some applications may not run properly."
"on the installation media. If you try to update using the\n" \
"current installation media, the system may not start or\n" \
"some applications may not run properly."
)
)
Update.IgnoreProductCompatibility
Expand Down
Loading

0 comments on commit b3e78e0

Please sign in to comment.