fix(format/yaml): move overflowing multiline flow scalars below their key - #11140
fix(format/yaml): move overflowing multiline flow scalars below their key#11140dyc3 wants to merge 1 commit into
Conversation
|
✅ Organic activityNo automation signals detected in the analyzed events. This is an automated analysis by AgentScan |
WalkthroughThe YAML formatter now detects line breaks in flow scalars and checks available width before placing them. Multiline scalars remain beside the key when they fit; otherwise, they move to an indented line. Single-line scalars keep their existing placement. New fixtures cover quoted, anchored, nested, and exact-width cases. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/biome_yaml_formatter/tests/specs/yaml/scalar/multiline_overflow.yaml`:
- Around line 13-15: Update the exact_fit fixture’s scalar text so the complete
line is exactly 80 characters wide, preserving its purpose of exercising the
equal-to-width formatting branch. Keep the existing YAML structure and add or
adjust only the necessary text; retain appropriate coverage for this exact-width
case.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 40286dd6-ce50-4259-9004-c868bb744384
⛔ Files ignored due to path filters (1)
crates/biome_yaml_formatter/tests/specs/yaml/scalar/multiline_overflow.yaml.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (2)
crates/biome_yaml_formatter/src/yaml/auxiliary/block_map_implicit_entry.rscrates/biome_yaml_formatter/tests/specs/yaml/scalar/multiline_overflow.yaml
| exact_fit: | ||
| deeply: | ||
| - name: first line is exactly eighty columns wide, so the scalar stays put |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make the exact-width fixture exactly 80 columns.
Line 15 is 78 characters long. It does not test the equal-to-width branch.
Proposed fix
- - name: first line is exactly eighty columns wide, so the scalar stays put
+ - name: first line is precisely eighty columns wide, so the scalar stays putAs per coding guidelines, all code changes must include appropriate tests.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| exact_fit: | |
| deeply: | |
| - name: first line is exactly eighty columns wide, so the scalar stays put | |
| exact_fit: | |
| deeply: | |
| - name: first line is precisely eighty columns wide, so the scalar stays put |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/biome_yaml_formatter/tests/specs/yaml/scalar/multiline_overflow.yaml`
around lines 13 - 15, Update the exact_fit fixture’s scalar text so the complete
line is exactly 80 characters wide, preserving its purpose of exercising the
equal-to-width formatting branch. Keep the existing YAML structure and add or
adjust only the necessary text; retain appropriate coverage for this exact-width
case.
Source: Coding guidelines
Summary
Before, a value always started after the key:
The fix gives multiline scalars two layouts:
or, when the first line would overflow:
Found this while manually stress testing with some huge yaml files.
implemented by fable 5/opus 5
Test Plan
added tests
Docs