Skip to content

unable to lint a limited subset of yaml tags on command line #4675

@DonEstefan

Description

@DonEstefan
Summary

running ansible-lint --tags yaml[truthy] should check only "yaml[truthy]" tag. But it checks all "yaml" tags.
I suspect this might be related to #3896

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
ansible-lint 25.1.2 using ansible-core:2.16.14 ansible-compat:25.1.2 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8

RHEL8 UBI Image:
$ rpm -qa | grep ^ansible
ansible-core-2.16.14-2.el8ap.noarch
ansible-runner-2.4.1-1.el8ap.noarch
ansible-sign-0.1.1-2.el8ap.noarch
ansible-lint-25.1.2-1.el8ap.noarch
ansible-test-2.16.14-2.el8ap.noarch

STEPS TO REPRODUCE
  1. create a file testfile.yml with this content:
first_var: "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"
second_var: yes
  1. check linting for yaml[truthy] tag
$ ansible-lint --tags yaml[truthy] testfile.yml
WARNING  Skipped installing old role dependencies due to running in offline mode.
WARNING  Skipped installing collection dependencies due to running in offline mode.
WARNING  Listing 2 violation(s) that are fatal
yaml[line-length]: Line too long (169 > 160 characters)
testfile.yml:1

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

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

# Rule Violation Summary

  1 yaml profile:basic tags:formatting,yaml
  1 yaml profile:basic tags:formatting,yaml

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

only yaml[truthy] violations should be returned

Actual Behavior

all yaml violations are returned

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugnewTriage required

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions