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

Variable naming standards different for tasks and blocks #1895

Closed
t-woerner opened this issue Feb 14, 2022 · 4 comments · Fixed by #2031
Closed

Variable naming standards different for tasks and blocks #1895

t-woerner opened this issue Feb 14, 2022 · 4 comments · Fixed by #2031
Labels
bug good first issue Bugs ideal for the first time, good for newcomers contributors help wanted

Comments

@t-woerner
Copy link

Summary

Using uppercase variables in tasks are reported as `var-naming: Task defines variables within 'vars' section that violates variable naming standards´. The same variables for blocks are not reported.

Issue Type
  • Bug Report
Ansible and Ansible Lint details
$ ansible --version
ansible [core 2.12.2]

$ ansible-lint --version
ansible-lint 5.4.0 using ansible 2.12.2
  • ansible installation method: pip
  • ansible-lint installation method: pip
OS / ENVIRONMENT

Fedora 35

STEPS TO REPRODUCE

Using ansible-lint on this playbook

---
- name: Test
  hosts: localhost

  tasks:
  - block:
      - name: foo1
        debug: msg="{{ FOO }}"
    vars:
      FOO: fooo1

  - name: foo2
    debug: msg="{{ FOO }}"
    vars:
      FOO: fooo2

results in

Failed to guess project directory using git: 
WARNING  Overriding detected file kind 'yaml' with 'playbook' for given positional argument: test.yml
WARNING  Listing 1 violation(s) that are fatal
var-naming: Task defines variables within 'vars' section that violates variable naming standards
test.yml:12 Task/Handler: foo2

You can skip specific rules or tags by adding them to your configuration file:
# .ansible-lint
warn_list:  # or 'skip_list' to silence them completely
  - experimental  # all rules tagged as experimental

Finished with 0 failure(s), 1 warning(s) on 1 files.
Desired Behavior

The issue needs to be reported for the task and the block.

Actual Behavior

The issue is only reported for the task, but not the block.

@t-woerner t-woerner added bug new Triage required labels Feb 14, 2022
@ssbarnea ssbarnea removed the new Triage required label Mar 9, 2022
@ssbarnea
Copy link
Member

ssbarnea commented Mar 9, 2022

A PR would be welcomed here!

@ganeshrn ganeshrn added good first issue Bugs ideal for the first time, good for newcomers contributors help wanted labels Mar 9, 2022
@nishipy
Copy link
Contributor

nishipy commented Mar 22, 2022

I would like to work for this!
/assign

@nishipy
Copy link
Contributor

nishipy commented Mar 22, 2022

If I understand correctly, we need to fix the matchplay method which has the 'block' information in its input data.

@nishipy
Copy link
Contributor

nishipy commented Mar 22, 2022

I created PR #2031. Please review it. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Bugs ideal for the first time, good for newcomers contributors help wanted
Projects
None yet
4 participants