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

YAMLFIX_LINE_LENGTH not respected #260

Open
ltog opened this issue Sep 19, 2023 · 1 comment
Open

YAMLFIX_LINE_LENGTH not respected #260

ltog opened this issue Sep 19, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ltog
Copy link

ltog commented Sep 19, 2023

Description

I use YAMLFIX_LINE_LENGTH and would expect that lines will not get longer than this number of characters. But they get longer anyway.

Steps to reproduce

  1. Create a file with this content and save it as long.yaml:
---
asdf:
  - asdfasdfasdfss: "{{ asdfasdfasdfasdfasdfasdfasdf }}/{{ (asdfasdfasdfasdfasdfasdfasdf + '/' + asdfasdfasdfasdfasdfasdfsdfk) | asdfasdfasdfasdfasdf('gwdgxd') }}"
  1. Run YAMLFIX_LINE_LENGTH="120" yamlfix long.yaml

Current behavior

The content of long.yaml will be:

---
asdf:
  - asdfasdfasdfss: "{{ asdfasdfasdfasdfasdfasdfasdf }}/{{ (asdfasdfasdfasdfasdfasdfasdf + '/' + asdfasdfasdfasdfasdfasdfsdfk)\
      \ | asdfasdfasdfasdfasdf('gwdgxd') }}"

Desired behavior

The output should be shorter, e.g.

---
asdf:
  - asdfasdfasdfss: "{{ asdfasdfasdfasdfasdfasdfasdf }}/{{ (asdfasdfasdfasdfasdfasdfasdf + '/'\
      \ + asdfasdfasdfasdfasdfasdfsdfk) | asdfasdfasdfasdfasdf('gwdgxd') }}"

If this is actually the desired behaviour, this should be written more clearly in the documentation.

Environment

------------------------------------------------------------------
     yamlfix: 1.14.0
     Python: 3.10.12
     Platform: Linux-5.15.0-83-generic-x86_64-with-glibc2.35
------------------------------------------------------------------
@ltog ltog added the bug Something isn't working label Sep 19, 2023
@lyz-code
Copy link
Owner

Hi @ltog, thanks for taking the time to open another issue. I agree that the desired behaviour is the one you expect. I'm not sure what is the algorithm ruyaml uses to split long lines, probably is something to look upstream. As with the other issue, if you could submit a PR it would be awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants