Skip to content

Commit 27a5441

Browse files
committed
(PUP-11993) Style/WhileUntilDo
This commit enables the Style/WhileUntilDo cop and fixes 24 autocorrectable offenses.
1 parent eeac9b5 commit 27a5441

File tree

19 files changed

+24
-28
lines changed

19 files changed

+24
-28
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -766,10 +766,6 @@ Style/TrivialAccessors:
766766
Style/WhenThen:
767767
Enabled: false
768768

769-
# This cop supports safe auto-correction (--auto-correct).
770-
Style/WhileUntilDo:
771-
Enabled: false
772-
773769
# This cop supports safe auto-correction (--auto-correct).
774770
Style/WhileUntilModifier:
775771
Exclude:

ext/windows/service/daemon.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def service_main(*argsv)
7575

7676
service = self
7777
@run_thread = Thread.new do
78-
while service.running? do
78+
while service.running?
7979
runinterval = service.parse_runinterval(ruby_puppet_cmd)
8080

8181
if service.state == RUNNING or service.state == IDLE

lib/puppet/application/face_base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def parse_options
7474
# non-option word to use as the action.
7575
action_name = nil
7676
index = -1
77-
until action_name or (index += 1) >= command_line.args.length do
77+
until action_name or (index += 1) >= command_line.args.length
7878
item = command_line.args[index]
7979
if item =~ /^-/
8080
option = @face.options.find do |name|

lib/puppet/face/help.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def horribly_extract_summary_from(appname)
207207
# depends on the implementation coincidence of how our pages are
208208
# formatted. If we can't match the pattern we expect we return the empty
209209
# string to ensure we don't blow up in the summary. --daniel 2011-04-11
210-
while line = help.shift do # rubocop:disable Lint/AssignmentInCondition
210+
while line = help.shift # rubocop:disable Lint/AssignmentInCondition
211211
md = /^puppet-#{appname}\([^)]+\) -- (.*)$/.match(line)
212212
if md
213213
return md[1]

lib/puppet/graph/simple_graph.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def tarjan(root, s)
106106
# decent Ruby stack.
107107
recur = [{ :node => root }]
108108

109-
until recur.empty? do
109+
until recur.empty?
110110
frame = recur.last
111111
vertex = frame[:node]
112112

@@ -210,7 +210,7 @@ def paths_in_cycle(cycle, max_paths = 1)
210210

211211
# frame struct is vertex, [path]
212212
stack = [[cycle.first, []]]
213-
while frame = stack.shift do # rubocop:disable Lint/AssignmentInCondition
213+
while frame = stack.shift # rubocop:disable Lint/AssignmentInCondition
214214
if frame[1].member?(frame[0]) then
215215
found << frame[1] + [frame[0]]
216216
break if found.length >= max_paths

lib/puppet/http/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def execute_streaming(request, options: {}, &block)
365365
response = nil
366366
done = false
367367

368-
until done do
368+
until done
369369
connect(request.uri, options: options) do |http|
370370
apply_auth(request, basic_auth) if redirects.zero?
371371

lib/puppet/pops/parser/epp_support.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def scan_epp
4444
interpolate_epp
4545

4646
# This is the lexer's main loop
47-
until queue.empty? && scn.eos? do
47+
until queue.empty? && scn.eos?
4848
token = queue.shift || lex_token
4949
if token
5050
yield [ctx[:after] = token[0], token[1]]

lib/puppet/pops/parser/heredoc_support.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def heredoc
8383
# (Endline in EBNF form): WS* ('|' WS*)? ('-' WS*)? endtag WS* \r? (\n|$)
8484
endline_pattern = /([[:blank:]]*)(?:([|])[[:blank:]]*)?(?:(-)[[:blank:]]*)?#{Regexp.escape(endtag)}[[:blank:]]*\r?(?:\n|\z)/
8585
lines = []
86-
until scn.eos? do
86+
until scn.eos?
8787
one_line = scn.scan_until(/(?:\n|\z)/)
8888
raise eof_error unless one_line
8989

lib/puppet/pops/parser/interpolation_support.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def enqueue_until brace_count
194194

195195
scn.skip(self.class::PATTERN_WS)
196196
queue_size = queue.size
197-
until scn.eos? do
197+
until scn.eos?
198198
token = lex_token
199199
if token
200200
if token.equal?(queue_base)
@@ -242,7 +242,7 @@ def transform_to_variable(token)
242242
def interpolate_uq_to(lexer)
243243
interpolate_uq
244244
queue = @token_queue
245-
until queue.empty? do
245+
until queue.empty?
246246
lexer.enqueue(queue.shift)
247247
end
248248
end

lib/puppet/pops/parser/lexer2.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ def scan
714714
scn.skip(PATTERN_WS)
715715

716716
# This is the lexer's main loop
717-
until queue.empty? && scn.eos? do
717+
until queue.empty? && scn.eos?
718718
token = queue.shift || selector[scn.peek(1)].call
719719
if token
720720
ctx[:after] = token[0]

0 commit comments

Comments
 (0)