Skip to content
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

Bug: YAML Key Sort Does Not Support Line Break Syntax #992

Open
2 of 3 tasks
bryanwhiting opened this issue Jan 7, 2024 · 2 comments
Open
2 of 3 tasks

Bug: YAML Key Sort Does Not Support Line Break Syntax #992

bryanwhiting opened this issue Jan 7, 2024 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed yaml YAML related issues or features

Comments

@bryanwhiting
Copy link

bryanwhiting commented Jan 7, 2024

  • I have verified that I am on the latest version of the Linter

Describe the Bug

Linting with line breaks doesn't work properly with the sorting feature. You'll notice the description falls down into the "draft" property.

Before lint:

title: 'hello'
description: |
  "Something nut"
date: 2024-01-07T00:00:00
updated: 2024-01-07T12:18:20
categories: favorite
draft: false
hi: |
  "Hello world"
bye: |
  There bob

After lint:

---
title: 'hello'
description: |
date: 2024-01-07T00:00:00
updated: 2024-01-07T12:21:18
categories: favorite
draft: false
  "Something nut"
hi: |
  "Hello world"
bye: |
  There bob
---

How to Reproduce

Sorting yaml rules in options

title:
description:
date:
updated:
categories:
draft:

Expected Behavior

It should not shift the stuff after "|" down.

Screenshots

See above

Device

  • Desktop
  • Mobile
@bryanwhiting bryanwhiting added the bug Something isn't working label Jan 7, 2024
@pjkaufman
Copy link
Collaborator

pjkaufman commented Jan 7, 2024

Hey @bryanwhiting . It looks like you ran into a
some YAML syntax that the Linter does not know how to handle. I am not sure when or if this will get addressed since there currently is not a good way to handle this scenario without reformatting the key value pairs at this time.

If someone would like to add a fix for this or handle this syntax before I or someone else does, feel free to make a PR.

In the meantime, if you do not have a particular reason to use the line break YAML syntax, I would not use it at this time.

@pjkaufman pjkaufman added the yaml YAML related issues or features label Jan 7, 2024
@pjkaufman pjkaufman changed the title Bug: Bug: YAML Key Sort Does Not Support Line Break Syntax Jan 7, 2024
@bryanwhiting
Copy link
Author

Thanks for the quick reply. I'll just turn off sorting for now then, as I'm probably useless in trying to resolve this.

Turning off sorting keys prevents the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed yaml YAML related issues or features
Projects
None yet
Development

No branches or pull requests

2 participants