yamlfix icon indicating copy to clipboard operation
yamlfix copied to clipboard

Line length is not respected for comments

Open lyz-code opened this issue 2 years ago • 2 comments

Description

Line cropping is not working for comments.

Steps to reproduce

Transform the next document:

# this_is_a_test: asdfasdfasfd asdf adsfasdfasdfasfd asdfasdfasdfasdfa adsfasdfasfdasdf asdfasdfasdfasdf asdfasdfasdfa asdfasdfasdf asdfasdfads asdfasdfasdf asdfasdfasdf asdfasfda
this_is_a_test: asdfasdfasfd asdf adsfasdfasdfasfd asdfasdfasdfasdfa adsfasdfasfdasdf asdfasdfasdfasdf asdfasdfasdfa asdfasdfasdf asdfasdfads asdfasdfasdf asdfasdfasdf asdfasfda

Current behavior

The non commented line gets cropped but the comment doesn't

---
# this_is_a_test: asdfasdfasfd asdf adsfasdfasdfasfd asdfasdfasdfasdfa adsfasdfasfdasdf asdfasdfasdfasdf asdfasdfasdfa asdfasdfasdf asdfasdfads asdfasdfasdf asdfasdfasdf asdfasfda
this_is_a_test: asdfasdfasfd asdf adsfasdfasdfasfd asdfasdfasdfasdfa adsfasdfasfdasdf
  asdfasdfasdfasdf asdfasdfasdfa asdfasdfasdf asdfasdfads asdfasdfasdf asdfasdfasdf
  asdfasfda

Desired behavior

The comment line is also cropped

lyz-code avatar Feb 02 '23 09:02 lyz-code

I'm pretty sure this is due to ruyaml (and ruamel) not fixing comments. I tried to play with them directly yesterday, and they did not fix the comments, so I think it's an upstream issue

babyhuey avatar Feb 02 '23 18:02 babyhuey

Opened the issue upstream. We can wait for them to fix it or we can patch it here in yamlfix until they do as we've done with other stuff.

Thank you @babyhuey for taking a look at it :)

lyz-code avatar Feb 03 '23 10:02 lyz-code