yamlfix
yamlfix copied to clipboard
Line length is not respected for 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
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
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 :)