test(linter/plugins): refactor report creation in conformance tester#16780
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
The refactor improves readability, but the new string-accumulation approach introduces correctness and maintainability risks around newline handling. report.slice(0, -1) can truncate output if the report doesn’t end with \n. The block() helper aggressively left-trims every line, which can silently break intentionally-indented Markdown if reused, and newline conventions are currently inconsistent across call sites.
Summary of changes
What changed
- Replaced the
lines: string[]accumulator (lines.push(...)+lines.join("\n")) with a singlereport: stringthat is appended to directly. - Introduced small helpers for report building:
line(str)appendsstr + "\n"lineBreak()appends a blank lineblock(str)normalizes indentation viatrimStart()+ per-linetrimStart()
- Consolidated the header + summary tables into a single template literal passed to
block(...). - Updated all report sections (fully passing, failures summary/details, load errors, no-tests) to use the new helpers.
- Changed return value to
return report.slice(0, -1)to remove a trailing newline.
There was a problem hiding this comment.
Pull request overview
This PR refactors the conformance test report generation by replacing an array-based approach with string concatenation. The refactor introduces three helper functions (line(), lineBreak(), and block()) to simplify the code and reduce repetitive lines.push() calls. However, the refactor introduces several critical bugs related to double newlines and changes the final output behavior.
Key changes:
- Replaces
lines: string[]array with direct string concatenation using areportvariable - Introduces helper functions
line(),lineBreak(), andblock()for string building - Converts template literal in summary statistics section to use
block()helper - Changes final return from
lines.join("\n")toreport.slice(0, -1)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
…16780) Pure refactor. In conformance tester, remove bunch of repeated `lines.push` calls to make report creation code easier to read.
831fc57 to
1fde9b6
Compare

Pure refactor. In conformance tester, remove bunch of repeated
lines.pushcalls to make report creation code easier to read.