Skip to content

Conversation

@quintush
Copy link

Fix parsing when multiline strings start with a line-ending (resolves #65)
Updated tests to validate the behaviour and did some code cleaning.

Copilot AI review requested due to automatic review settings October 20, 2025 21:06
Copy link

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 fixes a parsing bug where multiline strings starting with a line-ending were incorrectly handled. The fix removes the check for line breaks at the start of block scalar values, which was causing incorrect indentation hints to be written.

Key changes:

  • Modified writeBlockScalarHints to only check for leading spaces, not line breaks
  • Added test cases validating multiline strings with leading newlines
  • Updated existing test assertion to reflect corrected output format

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
emitterc.go Removed isLineBreak(value, 0) check from the condition that triggers indentation hints for block scalars
encode_test.go Added test cases for strings with leading newlines and updated assertion to match corrected behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@quintush quintush force-pushed the bugfix/EmptyLineAtStartParsingFixed branch from 7960667 to 96c32bb Compare November 14, 2025 14:58
@ingydotnet
Copy link
Member

Your commits seem to include a merge commit. We don't accept those. Can you adjust that?

$ git fetch [email protected]:helm-unittest/go-yaml.git bugfix/EmptyLineAtStartParsingFixed && git log --graph --decorate --pretty=oneline --abbrev-commit FETCH_HEAD | head -5
From github.com:helm-unittest/go-yaml
 * branch            bugfix/EmptyLineAtStartParsingFixed -> FETCH_HEAD
*   96c32bb Correct comment feedback
|\  
| * e99d6a6 (tag: v4.0.0-rc.3) Minimal fix for 2 Makefile bugs
| * f215992 Replace emitterError calls with errors.New calls
| * 7dee9b1 Apply code suggestions 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty line at start of string causes parse failure

2 participants