Skip to content

Commit c95aee1

Browse files
[fuzz_task][NFC] Use more format strings to simplify code. (#3991)
1 parent b9cf5e5 commit c95aee1

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

src/clusterfuzz/_internal/bot/tasks/utasks/fuzz_task.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -556,9 +556,8 @@ def sync_from_gcs(self):
556556
result = already_synced or self._sync_to_disk(self._corpus_directory)
557557
self._synced_files.clear()
558558
self._synced_files.update(self._walk())
559-
560-
logs.log('%d corpus files for target %s synced to disk.' % (len(
561-
self._synced_files), self._project_qualified_target_name))
559+
logs.log(f'{len(self._synced_files)} corpus files for target '
560+
f'{self._project_qualified_target_name} synced to disk.')
562561

563562
# On success of rsync, update the last sync file with current timestamp.
564563
if result and self._synced_files and not already_synced:
@@ -1133,8 +1132,8 @@ def write_crashes_to_big_query(group, context):
11331132

11341133
for error in errors:
11351134
logs.log_error(
1136-
('Ignoring error writing the crash (%s) to BigQuery.' %
1137-
group.crashes[error['index']].crash_type),
1135+
('Ignoring error writing the crash '
1136+
f'({group.crashes[error["index"]].crash_type}) to BigQuery.'),
11381137
exception=Exception(error))
11391138
except Exception:
11401139
logs.log_error('Ignoring error writing a group of crashes to BigQuery')
@@ -1196,19 +1195,14 @@ def key_fn(crash):
11961195
group.crashes[0].crash_state)
11971196
continue
11981197

1199-
logs.log(
1200-
'Process the crash group (file=%s, '
1201-
'fuzzed_key=%s, '
1202-
'return code=%s, '
1203-
'crash time=%d, '
1204-
'crash type=%s, '
1205-
'crash state=%s, '
1206-
'security flag=%s, '
1207-
'crash stacktrace=%s)' %
1208-
(group.main_crash.filename, group.main_crash.fuzzed_key,
1209-
group.main_crash.return_code, group.main_crash.crash_time,
1210-
group.main_crash.crash_type, group.main_crash.crash_state,
1211-
group.main_crash.security_flag, group.main_crash.crash_stacktrace))
1198+
logs.log(f'Process the crash group (file={group.main_crash.filename}, '
1199+
f'fuzzed_key={group.main_crash.fuzzed_key}, '
1200+
f'return code={group.main_crash.return_code}, '
1201+
f'crash time={group.main_crash.crash_time}, '
1202+
f'crash type={group.main_crash.crash_type}, '
1203+
f'crash state={group.main_crash.crash_state}, '
1204+
f'security flag={group.main_crash.security_flag}, '
1205+
f'crash stacktrace={group.main_crash.crash_stacktrace})')
12121206

12131207
if group.should_create_testcase():
12141208
group.newly_created_testcase = create_testcase(

0 commit comments

Comments
 (0)