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

var-naming[pattern] is also applied to vars that are not owned by the linted code #4095

Open
evgeni opened this issue Apr 8, 2024 · 0 comments
Labels

Comments

@evgeni
Copy link
Contributor

evgeni commented Apr 8, 2024

Summary

When linting roles/playbooks that include "foreign" roles and var-naming[pattern] is set, that pattern is also applied to vars passed to those foreign roles

Issue Type
  • Bug Report
OS / ENVIRONMENT
% ansible-lint --version
ansible-lint 24.2.1 using ansible-core:2.16.5 ansible-compat:4.1.11 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
  • ansible installation method: Fedora RPM (irrelevant)
  • ansible-lint installation method: pip (irrelevant)
STEPS TO REPRODUCE
% cat .ansible-lint 
---
var_naming_pattern: "^(__)?satellite_[a-z_][a-z0-9_]*$"

% cat playbooks/install.yml 
---
- name: Setup
  hosts: localhost
  tasks:
    - name: Setup repositories
      ansible.builtin.include_role:
        name: theforeman.operations.foreman_repositories
      vars:
        foreman_repositories_version: "3.10"

% ansible-lint          
WARNING  Listing 1 violation(s) that are fatal
var-naming[pattern]: Variables names should match ^(__)?satellite_[a-z_][a-z0-9_]*$ regex. (foreman_repositories_version) (vars: foreman_repositories_version)
playbooks/install.yml:9 Task/Handler: Setup repositories

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

                 Rule Violation Summary                 
 count tag                 profile rule associated tags 
     1 var-naming[pattern] basic   idiom                

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

I would expect ansible-lint to catch that this is calling out to foreign code, and not apply var-naming[pattern] here.

Actual Behavior

Please see above "steps to reproduce"

Additional information

I've seen this on 6.18.0 and 24.2.1.
I am certain some older version did not have this issue, but I don't have data which one exactly.

@evgeni evgeni added bug new Triage required labels Apr 8, 2024
@audgirka audgirka removed the new Triage required label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Roadmap
Development

No branches or pull requests

2 participants