Skip to content

Commit

Permalink
do not compare with nil
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Nov 26, 2014
1 parent 4cfcc1a commit 778e8fa
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 16 deletions.
6 changes: 0 additions & 6 deletions .rubocop.yml
Expand Up @@ -150,12 +150,6 @@ Style/MultilineOperationIndentation:
Style/NegatedIf:
Enabled: false

# Offense count: 17
# Cop supports --auto-correct.
# Configuration parameters: IncludeSemanticChanges.
Style/NonNilCheck:
Enabled: false

# Offense count: 66
# Cop supports --auto-correct.
Style/NumericLiterals:
Expand Down
2 changes: 1 addition & 1 deletion src/include/bootloader/grub2/options.rb
Expand Up @@ -246,7 +246,7 @@ def ConsoleHandle(_widget, _event)
_("Choose new graphical theme file")
)

UI.ChangeWidget(Id(:gfxtheme), :Value, file) if file != nil
UI.ChangeWidget(Id(:gfxtheme), :Value, file) if !file.nil?

nil
end
Expand Down
4 changes: 2 additions & 2 deletions src/include/bootloader/routines/autoinstall.rb
Expand Up @@ -150,7 +150,7 @@ def AI2Export(ai)
# device map stuff
if Ops.greater_than(Builtins.size(Ops.get_list(ai, "device_map", [])), 0)
dm = Ops.get_list(ai, "device_map", [])
if dm != nil && Ops.greater_than(Builtins.size(dm), 0)
if !dm.nil? && Ops.greater_than(Builtins.size(dm), 0)
device_map = Builtins.listmap(dm) do |entry|
firmware = Builtins.deletechars(
Ops.get(entry, "firmware", ""),
Expand Down Expand Up @@ -281,7 +281,7 @@ def Export2AI(exp)
if !exp.fetch("specific", {}).fetch("device_map", {}).empty?
device_map = Ops.get_map(exp, ["specific", "device_map"], {})
Builtins.y2milestone("DM: %1", device_map)
if device_map != nil && Ops.greater_than(Builtins.size(device_map), 0)
if !device_map.nil? && Ops.greater_than(Builtins.size(device_map), 0)
dm = Builtins.maplist(device_map) do |linux, firmware|
{ "linux" => linux, "firmware" => firmware }
end
Expand Down
2 changes: 1 addition & 1 deletion src/include/bootloader/routines/common_options.rb
Expand Up @@ -96,7 +96,7 @@ def HandleGlobalBrowse(widget, _event)
current = Convert.to_string(UI.QueryWidget(Id(widget), :Value))
# file open popup caption
current = UI.AskForExistingFile(current, "*", _("Select File"))
UI.ChangeWidget(Id(widget), :Value, current) if current != nil
UI.ChangeWidget(Id(widget), :Value, current) if !current.nil?
nil
end

Expand Down
2 changes: 1 addition & 1 deletion src/include/bootloader/routines/global_widgets.rb
Expand Up @@ -303,7 +303,7 @@ def getAdvancedButtonWidget
# Get general widgets for global bootloader options
# @return a map describing all general widgets for global options
def CommonGlobalWidgets
if @_common_global_widgets != nil
if !@_common_global_widgets.nil?
return deep_copy(@_common_global_widgets)
end
@_common_global_widgets = {
Expand Down
8 changes: 4 additions & 4 deletions src/include/bootloader/routines/misc.rb
Expand Up @@ -275,7 +275,7 @@ def UpdateInstallationKernelParameters
end
if Kernel.GetVgaType == ""
vgaType = Ops.get_string(saved_params, "vgamode", "")
Kernel.SetVgaType(vgaType) if vgaType != nil && vgaType != ""
Kernel.SetVgaType(vgaType) if !vgaType.nil? && vgaType != ""
end
if !Stage.initial
Kernel.SetCmdLine(
Expand Down Expand Up @@ -412,7 +412,7 @@ def getBootDisk

boot_disk_device = Ops.get_string(p_dev, "disk", "")

if boot_disk_device != "" && boot_disk_device != nil
if boot_disk_device != "" && !boot_disk_device.nil?
Builtins.y2milestone("Boot device - disk: %1", boot_disk_device)
return boot_disk_device
end
Expand Down Expand Up @@ -574,7 +574,7 @@ def HandleConsole2

if Ops.get(@globals, "append") != nil
updated_append = ""
if console_value != "" || console_value != nil
if console_value != "" || !console_value.nil?
updated_append = UpdateSerialConsole(
Ops.get(@globals, "append", ""),
console_value
Expand All @@ -585,7 +585,7 @@ def HandleConsole2
""
)
end
Ops.set(@globals, "append", updated_append) if updated_append != nil
Ops.set(@globals, "append", updated_append) if !updated_append.nil?
end

nil
Expand Down
2 changes: 1 addition & 1 deletion src/lib/bootloader/grub2base.rb
Expand Up @@ -116,7 +116,7 @@ def Propose

resume = BootArch.ResumeAvailable ? largest_swap_part : ""
# try to use label or udev id for device name... FATE #302219
if resume != "" && resume != nil
if resume != "" && !resume.nil?
resume = ::Bootloader::UdevMapping.to_mountby_device(resume)
end

Expand Down

0 comments on commit 778e8fa

Please sign in to comment.