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 --version
ansible-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'.
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:
1)
.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: