[refactor] Introduce a TruncationBudget for assertion truncation#14652
Open
Pierre-Sassoulas wants to merge 1 commit into
Open
[refactor] Introduce a TruncationBudget for assertion truncation#14652Pierre-Sassoulas wants to merge 1 commit into
Pierre-Sassoulas wants to merge 1 commit into
Conversation
Bundle the (max_lines, max_chars) pair that the truncation machinery passes around into a small frozen, keyword-only TruncationBudget. _get_truncation_parameters now returns (should_truncate, budget) and _truncate_explanation takes the budget directly. Keyword-only construction means the two limits can never be silently swapped at a call site. The budget carries the truncation_limit_lines / truncation_limit_chars ini values verbatim — positive bounds the dimension, 0 leaves it unbounded — so there is no extra sentinel translation. Pure refactor: truncation behaviour, footer wording and hidden-line count are unchanged.
Member
Author
|
@bluetech what do you think ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposal of refactor prior to #14523 where a lot of truncation budget will be passed around in assertion generator.
Bundle the (max_lines, max_chars) pair that the truncation machinery passes around into a small frozen, keyword-only TruncationBudget. _get_truncation_parameters now returns (should_truncate, budget) and _truncate_explanation takes the budget directly. Keyword-only construction means the two limits can never be silently swapped at a call site.
The budget carries the truncation_limit_lines / truncation_limit_chars ini values verbatim — positive bounds the dimension, 0 leaves it unbounded — so there is no extra sentinel translation. Pure refactor: truncation behaviour, footer wording and hidden-line count are unchanged.