Skip to content

Commit e741f21

Browse files
authored
Add --omit-repl flag to the gh_report tool (#3413)
## Why <!-- Why are these changes needed? Provide the context that the reviewer might be missing. For example, were there any decisions behind the change that are not reflected in the code itself? --> Skipping the lines that print out available replacements when reading out failed tests log significantly reduces noise and cognitive load for the reader. ## Tests <!-- How have you tested the changes? --> Manually ran `gh_report` with the flag and without the flag and confirmed that both outputs still work <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
1 parent ad058ed commit e741f21

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

tools/gh_parse.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def parse_file(path, filter):
116116
return results, outputs
117117

118118

119-
def print_report(filenames, filter, filter_env, show_output, markdown=False):
119+
def print_report(filenames, filter, filter_env, show_output, markdown=False, omit_repl=False):
120120
outputs = {} # testname -> env -> [output]
121121
per_test_per_env_stats = {} # testname -> env -> action -> count
122122
all_testnames = set()
@@ -256,7 +256,11 @@ def is_bug(test_results):
256256
for env, action in stats.items():
257257
if action not in INTERESTING_ACTIONS:
258258
continue
259-
out = "\n".join(outputs.get(testname, {}).get(env, []))
259+
output_lines = outputs.get(testname, {}).get(env, [])
260+
if omit_repl:
261+
output_lines = [line for line in output_lines if not line.strip().startswith("REPL") and "Available replacements:" not in line]
262+
out = "\n".join(output_lines)
263+
260264
if markdown:
261265
print(f"### {env} {testname} {action}\n```\n{out}\n```")
262266
else:
@@ -329,8 +333,11 @@ def main():
329333
parser.add_argument("--filter-env", help="Filter results by env name (substring match)")
330334
parser.add_argument("--output", help="Show output for failed tests", action="store_true")
331335
parser.add_argument("--markdown", help="Output in GitHub-flavored markdown format", action="store_true")
336+
parser.add_argument("--omit-repl", help="Omit lines starting with 'REPL' and containing 'Available replacements:'", action="store_true")
332337
args = parser.parse_args()
333-
print_report(args.filenames, filter=args.filter, filter_env=args.filter_env, show_output=args.output, markdown=args.markdown)
338+
print_report(
339+
args.filenames, filter=args.filter, filter_env=args.filter_env, show_output=args.output, markdown=args.markdown, omit_repl=args.omit_repl
340+
)
334341

335342

336343
if __name__ == "__main__":

tools/gh_report.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def main():
136136
parser.add_argument("--filter-env", help="Filter results by env name (substring match)")
137137
parser.add_argument("--output", help="Show output for failing tests", action="store_true")
138138
parser.add_argument("--markdown", help="Output in GitHub-flavored markdown format", action="store_true")
139+
parser.add_argument("--omit-repl", help="Omit lines starting with 'REPL' and containing 'Available replacements:'", action="store_true")
139140

140141
# This does not work because we don't store artifacts for unit tests. We could download logs instead but that requires different parsing method:
141142
# ~/work/cli % gh api -H "Accept: application/vnd.github+json" /repos/databricks/cli/actions/runs/15827411452/logs > logs.zip
@@ -172,6 +173,8 @@ def main():
172173
cmd.append("--output")
173174
if args.markdown:
174175
cmd.append("--markdown")
176+
if args.omit_repl:
177+
cmd.append("--omit-repl")
175178
cmd.append(f"{target_dir}")
176179
run(cmd, shell=True)
177180

0 commit comments

Comments
 (0)