You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file passes all ansible-lint tests. However, running ansible-lint --write reassembles the two lines into one
This exceeds ansible-lint yaml[line-length] criterium, litterally meaning that ansible-lint --write created a ansible-lint violation.
Before any contribution, I may need the input from a more experienced developer on this project.
As far as I understant the problem, this seems to come from the 'round-trip' functionality of ruamel.yaml, which doesn't seem to customisable in terms of max length of line in the output.
In your opinion, should it be a contribution to ruamel.yaml, or should we process the ruamel.yaml output with another tool to break long lines into multiline strings, using the yamllint configured max line length?
However, ruamel does support the other recommended syntax for writing multiline strings (i.e. using Block Style Indicators "|" and ">"). We are documenting this thing over here, using this ansible-lint --write will no longer collapse your multiline string.
Summary
Issue Type
OS / ENVIRONMENT
ansible-lint 6.17.1 using ansible-core:2.15.1 ruamel-yaml:0.17.26 ruamel-yaml-clib:0.2.7
STEPS TO REPRODUCE
As a mean of complying with the yaml[line-length] rule with long strings without spaces (URL, for instance), one could do the following:
This file passes all ansible-lint tests. However, running
ansible-lint --write
reassembles the two lines into oneThis exceeds ansible-lint yaml[line-length] criterium, litterally meaning that ansible-lint --write created a ansible-lint violation.
Desired Behavior
Hopefully, ansible-lint --write would preserve the line-length rule, not removing the escaped newlines
Actual Behavior
The variable is rewritten on a single line, failing the test.
The text was updated successfully, but these errors were encountered: