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
ansible-lint --fix does not respect the maximum yaml line length in a repo where the line length is specified in a .yamllint file and multi-line strings use double quotes with a \ to wrap onto the next line.
When running ansible-lint --fix twice, the double quotes and line split are removed on the first pass, followed by a line-length error on the second pass.
Issue Type
Bug Report
OS / ENVIRONMENT
MacOS Sonoma 14.5
ansible-lint --versionansible-lint 24.6.1 using ansible-core:2.17.1 ansible-compat:24.6.1 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
I expected the multi-line string to be ignored since the a fix might combined the multiline string into a single line thereby surpassing the max line length limit.
Actual Behavior
The second iteration of running ansible-lint --fix returns the following line too long error, even though it was fine before running ansible-lint:
ERROR Rule specific fix not applied for: yaml/yaml roles/arole/tasks/main.yml:4
WARNING Listing 1 violation(s) that are fatal
yaml[line-length]: Line too long (94 > 88 characters)
roles/arole/tasks/main.yml:4
Read documentation for instructions on how to ignore specific rule violations.
Rule Violation Summary
count tag profile rule associated tags
1 yaml[line-length] basic formatting, yaml
Failed: 1 failure(s), 0 warning(s) on 4 files. Last profile that met the validation criteria was 'min'.
The text was updated successfully, but these errors were encountered:
Adhering to yaml[line-length] rule, for writing multiline strings we recommend using Block Style Indicator: literal style indicated by a pipe (|) or folded style indicated by a right angle bracket (>), instead of escaping the newlines with backslashes.
I'd agree with this statement except for when it is not applicable to a long line that cannot have spaces in them (such as a URL) and therefore invalidates the use of Block Scalars.
Summary
ansible-lint --fix
does not respect the maximum yaml line length in a repo where the line length is specified in a .yamllint file and multi-line strings use double quotes with a \ to wrap onto the next line.When running
ansible-lint --fix
twice, the double quotes and line split are removed on the first pass, followed by a line-length error on the second pass.Issue Type
OS / ENVIRONMENT
MacOS Sonoma 14.5
STEPS TO REPRODUCE
A minimum test repo contains two files:
.yamllint
file:and 2) a
roles/arole/tasks/main.yml
file:Then run
ansible-lint --fix
twice.Desired Behavior
I expected the multi-line string to be ignored since the a fix might combined the multiline string into a single line thereby surpassing the max line length limit.
Actual Behavior
The second iteration of running
ansible-lint --fix
returns the following line too long error, even though it was fine before running ansible-lint:The text was updated successfully, but these errors were encountered: