ansible-lint
ansible-lint copied to clipboard
Add test for newlines at single line variables using pipe blocks
Summary
vars:
capture_file: |
{{ something }}
I encountered accidental introduction of bugs while trying to shorten the line width or removal of the quoting and forget that |
introduces a newline at the end. In some cases this newline breaks code.
The proposal is to add a test that warns user about dangers that this construct produces a string ending with a newline.
The warning should not appear if the code already has more than one line and should also be easy to bypass using a # noqa XYZ
comment.
Issue Type
- Feature Idea
Additional Information
Here is example of change fixing such a bug https://review.opendev.org/#/c/722336/