class

Krikri::Lint::VarNamingRule

Inherits Krikri::Lint::Rule < Reference < Object

Upstream parity: ansible-lint's var-naming rule family (severity MEDIUM, tags idiom). Checks var identifiers in play vars, task vars, set_fact keys, and register against Ansible's reserved names and the ^[a-z_][a-z0-9_]*$ pattern, plus no-role-prefix: keys in role defaults/vars files, keys on playbook roles: entries, and vars/set_fact/register on include_role/import_role tasks must use the role's name as prefix (FQCN role names skip the prefix/pattern checks).

Constants

ALLOWED_SPECIAL = ["ansible_facts", "ansible_become_user", "ansible_connection", "ansible_host", "ansible_python_interpreter", "ansible_user", "ansible_remote_tmp"] of ::String
PATTERN = /^[a-z_][a-z0-9_]*$/
RESERVED = ["action", "always", "any_errors_fatal", "become", "become_exe", "become_flags", "become_method", "become_user", "block", "changed_when", "check_mode", "collections", "connection", "debugger", "delay", "delegate_to", "delegate_facts", "diff", "environment", "failed_when", "failed_when_result", "force_handlers", "gather_facts", "gather_subset", "gather_timeout", "handlers", "ignore_errors", "ignore_unreachable", "import_playbook", "import_role", "import_tasks", "include", "include_role", "include_tasks", "include_vars", "listen", "load_vars", "local_action", "loop", "loop_control", "module_defaults", "name", "no_log", "notify", "order", "poll", "port", "post_tasks", "pre_tasks", "private_role_vars", "register", "remote_user", "rescue", "roles", "run_once", "tags", "tasks", "throttle", "timeout", "until", "vars", "vars_files", "when", "with_"] of ::String

ansible.vars.reserved.get_reserved_names() - stable core set.

ROLE_KEYWORDS = ["any_errors_fatal", "become", "become_exe", "become_flags", "become_method", "become_user", "check_mode", "collections", "connection", "debugger", "delegate_facts", "delegate_to", "diff", "environment", "ignore_errors", "ignore_unreachable", "module_defaults", "name", "role", "no_log", "port", "remote_user", "run_once", "tags", "throttle", "timeout", "vars", "when"] of ::String

Keys of a play's roles: entry that are not role variables (compatibility surface: the documented play keywords).

Instance methods

applies_to
Source
check(file : PositionedFile, violations : Array(Violation)) : Nil
Source
severity
Source
tags
Source
task_scoped?

Task-oriented: violations belong to an enclosing task, so a # noqa: anywhere in that task's body suppresses them.

Source