Skip to content

Fix misaligned indentation in comments #734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025
Merged

Conversation

shuheiktgw
Copy link
Collaborator

@shuheiktgw shuheiktgw commented May 16, 2025

Fixes #713 🙏

  • Describe the purpose for which you created this PR.
  • Create test code that corresponds to the modification

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.95%. Comparing base (500180b) to head (aa06d04).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #734   +/-   ##
=======================================
  Coverage   77.94%   77.95%           
=======================================
  Files          22       22           
  Lines        7998     8001    +3     
=======================================
+ Hits         6234     6237    +3     
  Misses       1349     1349           
  Partials      415      415           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mallardduck
Copy link

Not a reviewer on this repo but I reported experiencing this bug. Upon testing my project with this branch I'm happy to report it works fine now. PR LGTM :shipit: !

Copy link
Owner

@goccy goccy left a comment

Choose a reason for hiding this comment

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

Thank you !!!!! LGTM 👍

@goccy goccy merged commit f1c23f7 into master May 29, 2025
25 checks passed
@goccy goccy deleted the misaligned_comment_indentation branch May 29, 2025 04:34
@mallardduck
Copy link

mallardduck commented May 29, 2025

Sorry I didn't fully test this early, but I just realized that this isn't a complete fix for the issue. While this addresses the initial error seen as a parsing error, if/when the files affected by this are saved their comments will not respect original indentation.

Specifically this does not account for and fails if this test is added:

		{
			name: "commented values.yaml with uneven indentation",
			yaml: `
topLevelNode:
  attribute: true
  # comment about the next attribute
  # someOptInFeature: true
  allGoodSoFar: true
    # until this breaks it
  despair: true
`,
		},

I have created #747 as a follow up.

# commentH
`,
expected: `
# commentA

Choose a reason for hiding this comment

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

Ohh, I also overlooked that this test specifically makes it so that it's expected for this to modify comment indentation.

I'm not sure that this makes sense for the default behaviour. Since if comments are supposed to be parsed and respected the same as other fields, then changing indentation should be seen as breaking. However if someone wanted to "beautify" a file I could see this behaviour as beneficial via opt-in setting.

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.

Comment that is indented farther causes a parsing error
4 participants