Skip to content

var-naming[no-role-prefix] is not detected in a role's handlers files #4816

@cavcrosby

Description

@cavcrosby
Summary

The var-naming[no-role-prefix] rule is not detected in a role's handlers files that register variables with no prefix.

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint 25.9.2 using ansible-core:2.17.0 ansible-compat:25.8.2 ruamel-yaml:0.18.15 ruamel-yaml-clib:0.2.14
  • ansible installation method: pip
  • ansible-lint installation method: pip
STEPS TO REPRODUCE
Setup
mkdir -p ./roles/test/{handlers,tasks}

cat << _EOF_ > "./roles/test/handlers/main.yml"
---
- name: Echo thefoo
  ansible.builtin.command: echo thefoo
  changed_when: true
  register: thefoo
_EOF_

cat << _EOF_ > "./roles/test/tasks/main.yml"
---
- name: Ls the root directory
  ansible.builtin.command: ls /
  changed_when: true
  register: test_foo
  notify: Echo thefoo
_EOF_
Run
ansible-lint --offline
Desired Behavior

I would expect that the var-naming[no-role-prefix] rule to be detected/violated in the role's handlers files tested. Especially since this rule has been extended to include variables defined by a role's tasks files (#4677).

Actual Behavior

The actual behavior is that the var-naming[no-role-prefix] rule is not detected/violated in the role's handlers files tested.

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