Skip to content

Post feedback using --fix is confusing #3772

@cidrblock

Description

@cidrblock

Assume the following playbook:

- hosts: localhost
  gather_facts: False
  tasks:
    - name: Create a new user
      user:
        name: "{{ user_name }}"
        password: "{{ user_password }}"
        shell: /bin/bash
        groups: sudo
        append: yes
        state: present

Running lint without fix correctly reports the following:

name[play]: All plays should be named.
site.yml:1

yaml[document-start]: Missing document start "---"
site.yml:1

yaml[truthy]: Truthy value should be one of [false, true]
site.yml:2

fqcn[action-core]: Use FQCN for builtin module actions (user).
site.yml:4 Use `ansible.builtin.user` or `ansible.legacy.user` instead.

yaml[truthy]: Truthy value should be one of [false, true]
site.yml:10

Read documentation for instructions on how to ignore specific rule violations.

                   Rule Violation Summary                   
 count tag                  profile    rule associated tags 
     1 name[play]           basic      idiom                
     1 yaml[document-start] basic      formatting, yaml     
     2 yaml[truthy]         basic      formatting, yaml     
     1 fqcn[action-core]    production formatting           

Failed: 5 failure(s), 0 warning(s) on 1 files. Last profile that met the validation criteria was 'min'.

Running lint with --fix=all reports the following:

name[play]: All plays should be named.
site.yml:1

yaml[document-start]: Missing document start "---"
site.yml:1

yaml[truthy]: Truthy value should be one of [false, true]
site.yml:2

yaml[truthy]: Truthy value should be one of [false, true]
site.yml:10

Read documentation for instructions on how to ignore specific rule violations.

Modified 1 files.
                   Rule Violation Summary                   
 count tag                  profile    rule associated tags 
     1 name[play]           basic      idiom                
     1 yaml[document-start] basic      formatting, yaml     
     2 yaml[truthy]         basic      formatting, yaml     
     1 fqcn[action-core]    production formatting           

Failed: 4 failure(s), 0 warning(s), and fixed 1 issue(s) on 1 files. Last profile that met the validation criteria was 'min'.

- Should we report rule violations that were fixed? Or can we note they were fixed in the output?
- The cound of fixed issues is 1, while three were fixed.

The resulting file is:

---
- hosts: localhost
  gather_facts: false
  tasks:
    - name: Create a new user
      ansible.builtin.user:
        name: "{{ user_name }}"
        password: "{{ user_password }}"
        shell: /bin/bash
        groups: sudo
        append: true
        state: present

and running lint again reports:

name[play]: All plays should be named.
site.yml:2

Read documentation for instructions on how to ignore specific rule violations.

            Rule Violation Summary             
 count tag        profile rule associated tags 
     1 name[play] basic   idiom                

Failed: 1 failure(s), 0 warning(s) on 1 files. Last profile that met the validation criteria was 'min'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions