Skip to content

test(linter/plugins): refactor report creation in conformance tester#16780

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-12-test_linter_plugins_refactor_report_creation
Dec 12, 2025
Merged

test(linter/plugins): refactor report creation in conformance tester#16780
graphite-app[bot] merged 1 commit intomainfrom
12-12-test_linter_plugins_refactor_report_creation

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Dec 12, 2025

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

Copy link
Member Author

overlookmotel commented Dec 12, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins labels Dec 12, 2025
@github-actions github-actions bot added the C-test Category - Testing. Code is missing test cases, or a PR is adding them label Dec 12, 2025
@overlookmotel overlookmotel changed the title test(linter/plugins): refactor report creation test(linter/plugins): refactor report creation in conformance tester Dec 12, 2025
@overlookmotel overlookmotel marked this pull request as ready for review December 12, 2025 17:19
Copilot AI review requested due to automatic review settings December 12, 2025 17:19
@overlookmotel overlookmotel self-assigned this Dec 12, 2025
Copy link

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 single report: string that is appended to directly.
  • Introduced small helpers for report building:
    • line(str) appends str + "\n"
    • lineBreak() appends a blank line
    • block(str) normalizes indentation via trimStart() + per-line trimStart()
  • 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 a report variable
  • Introduces helper functions line(), lineBreak(), and block() for string building
  • Converts template literal in summary statistics section to use block() helper
  • Changes final return from lines.join("\n") to report.slice(0, -1)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 12, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 12, 2025

Merge activity

…16780)

Pure refactor. In conformance tester, remove bunch of repeated `lines.push` calls to make report creation code easier to read.
@graphite-app graphite-app bot force-pushed the 12-12-test_linter_plugins_refactor_report_creation branch from 831fc57 to 1fde9b6 Compare December 12, 2025 17:28
@graphite-app graphite-app bot merged commit 1fde9b6 into main Dec 12, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 12-12-test_linter_plugins_refactor_report_creation branch December 12, 2025 17:34
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-test Category - Testing. Code is missing test cases, or a PR is adding them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants