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

ansible-lint --fix does not respect custom yamllint configuration for empty lines #4316

Open
mjnaderi opened this issue Sep 7, 2024 · 0 comments
Assignees
Labels

Comments

@mjnaderi
Copy link

mjnaderi commented Sep 7, 2024

Summary

I want to be able to put two empty lines between some tasks in a single file to make a visual separation between groups of related tasks and improve readability. Example:

---
- name: task 1
  ...

- name: task 2
  ...


- name: task 3
  ...

- name: task 4
  ...

To achieve that, I wrote a custom .yamllint.yml file with the following content:

---
rules:
  empty-lines:
    max: 2

But it does not help, and running ansible-lint --fix removes extra empty line, and the result has exactly one empty line between tasks.

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version

ansible-lint 24.7.0 using ansible-core:2.17.1 ansible-compat:24.6.1 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
  • ansible installation method: pipx
  • ansible-lint installation method: pipx
STEPS TO REPRODUCE
  1. Create a .yamllint.yml file with the following content:

    ---
    rules:
      empty-lines:
        max: 2
  2. Run ansible-lint --fix on a playbook with more than one empty line between tasks.

Desired Behavior

The ansible-lint --fix command should respect the custom .yamllint.yml configuration and allow up to two empty lines between tasks.

Actual Behavior

Running ansible-lint --fix removes extra empty lines and results in exactly one empty line between tasks.

@mjnaderi mjnaderi added bug new Triage required labels Sep 7, 2024
@Qalthos Qalthos assigned Qalthos and tanwigeetika1618 and unassigned Qalthos Sep 25, 2024
@Qalthos Qalthos removed the new Triage required label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

3 participants