Skip to content

Commit a8b2b1c

Browse files
committed
publish_toolstate: don't use 'new' from inside the loop
1 parent dbec74f commit a8b2b1c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/tools/publish_toolstate.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ def update_latest(
135135
for status in latest:
136136
tool = status['tool']
137137
changed = False
138-
create_issue = False
138+
create_issue_for_status = None # set to the status that caused the issue
139139

140140
for os, s in current_status.items():
141141
old = status[os]
142142
new = s.get(tool, old)
143143
status[os] = new
144-
if new > old:
144+
if new > old: # comparing the strings, but they are ordered appropriately!
145145
# things got fixed or at least the status quo improved
146146
changed = True
147147
message += '🎉 {} on {}: {} → {} (cc {}, @rust-lang/infra).\n' \
@@ -156,12 +156,12 @@ def update_latest(
156156
# Most tools only create issues for build failures.
157157
# Other failures can be spurious.
158158
if new == 'build-fail' or (tool == 'miri' and new == 'test-fail'):
159-
create_issue = True
159+
create_issue_for_status = new
160160

161-
if create_issue:
161+
if create_issue_for_status is not None:
162162
try:
163163
issue(
164-
tool, new, MAINTAINERS.get(tool, ''),
164+
tool, create_issue_for_status, MAINTAINERS.get(tool, ''),
165165
relevant_pr_number, relevant_pr_user, pr_reviewer,
166166
)
167167
except IOError as e:

0 commit comments

Comments
 (0)