Skip to content

Commit

Permalink
avoid literals in conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jan 13, 2015
1 parent 651d6c9 commit 295c182
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 30 deletions.
4 changes: 0 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
inherit_from:
/usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml

# Offense count: 14
Lint/LiteralInCondition:
Enabled: false

# Offense count: 17
Lint/Loop:
Enabled: false
Expand Down
2 changes: 1 addition & 1 deletion library/control/src/modules/InstError.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def ShowErrorPopUp(heading, error_text, details)

uret = nil

while true
loop do
uret = UI.UserInput

if uret == :save_y2logs
Expand Down
2 changes: 1 addition & 1 deletion library/desktop/src/clients/menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def main
ReplaceModuleList(@first)
UI.SetFocus(Id(:groups))

while true
loop do
@event = UI.WaitForEvent
@eventid = Ops.get(@event, "ID")
# y2debug too constly: y2debug("event=%1", event);
Expand Down
2 changes: 1 addition & 1 deletion library/general/src/modules/Popup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ def anyMessageDetailsInternalType(headline, message, details, icon_name, richtex

UI.SetFocus(Id(:ok_msg))

while true
loop do
ret = UI.UserInput
if ret == :details
success2 = UI.OpenDialog(
Expand Down
2 changes: 1 addition & 1 deletion library/log/examples/logviewcore1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def main

LogViewCore.Start(Id(:log), "file" => @file )

while true
loop do
@widget = UI.TimeoutUserInput(250)

if @widget == :timeout
Expand Down
2 changes: 1 addition & 1 deletion library/log/examples/logviewcore2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def main

LogViewCore.Start(Id(:log), "file" => @file, "grep" => @grep )

while true
loop do
@widget = UI.TimeoutUserInput(250)

if @widget == :timeout
Expand Down
2 changes: 1 addition & 1 deletion library/log/examples/logviewcore3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def main

LogViewCore.Start(Id(:log), "command" => @command )

while true
loop do
@widget = UI.TimeoutUserInput(250)

if @widget == :timeout
Expand Down
2 changes: 1 addition & 1 deletion library/log/src/modules/LogViewCore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def GetNewLines

new_lines = []

while true
loop do
line = Convert.to_string(SCR.Read(path(".process.read_line"), @id))
break if line == nil

Expand Down
2 changes: 1 addition & 1 deletion library/network/src/modules/PortRanges.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def FlattenServices(old_list, protocol)
# Joining port ranges together
# this is a bit dangerous!
Builtins.y2milestone("Joining list of ranges %1", list_of_ranges)
while true && Ops.greater_than(max_loops, 0)
while Ops.greater_than(max_loops, 0)
# if something goes wrong
max_loops = Ops.subtract(max_loops, 1)

Expand Down
6 changes: 3 additions & 3 deletions library/packages/src/modules/SignatureCheckDialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def StringSplitter(whattosplit, delimiter, after_chars)
after_chars_counter = 0
max_size = Builtins.size(whattosplit)

while true
loop do
if Ops.greater_or_equal(
Ops.add(after_chars_counter, after_chars),
max_size
Expand Down Expand Up @@ -387,7 +387,7 @@ def WaitForYesNoCancelUserInput
user_input = nil
ret = nil

while true
loop do
user_input = UI.UserInput
# yes button
if user_input == :yes
Expand Down Expand Up @@ -420,7 +420,7 @@ def WaitForSymbolUserInput(list_of_accepted, default_symb)
user_input = nil
ret = nil

while true
loop do
user_input = Convert.to_symbol(UI.UserInput)
if Builtins.contains(list_of_accepted, user_input)
ret = user_input
Expand Down
2 changes: 1 addition & 1 deletion library/packages/src/modules/Slides.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def LoadSlideFile(slide_name)
#
# Fix <img src> tags: Replace image path with current slide_pic_path
#
while true
loop do
replaced = Builtins.regexpsub(
text,
"(.*)&imagedir;(.*)",
Expand Down
13 changes: 0 additions & 13 deletions library/packages/testsuite/packages-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,6 @@ def main
T(->() { Package.DoRemove([@e]) }, true)
T(->() { Package.Installed(@e) }, false)

if false
T(->() { Package.Install(@n) }, false)
T(->() { Package.Install(@e) }, false)

Package.InstallAll(@el)
Package.InstallAny(@el)

Package.Remove(@e)
Package.RemoveAll(@el)

Package.DoInstallAndRemove([], [])
end

Popup.AnyMessage(
"Package Testsuite",
Builtins.sformat(
Expand Down
2 changes: 1 addition & 1 deletion library/sequencer/src/modules/Sequencer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def Run(aliases, sequence)
return Convert.to_symbol(WS_error("Starting dialog not found"))
end

while true
loop do
if Ops.is_symbol?(current)
Builtins.y2debug("Finished")
return Convert.to_symbol(current)
Expand Down

0 comments on commit 295c182

Please sign in to comment.