Skip to content

ci(lint): enforce var-naming[no-role-prefix] and production profile - #130

Merged
sbaerlocher merged 2 commits into
mainfrom
refactor/var-naming-role-prefix
Aug 10, 2026
Merged

ci(lint): enforce var-naming[no-role-prefix] and production profile#130
sbaerlocher merged 2 commits into
mainfrom
refactor/var-naming-role-prefix

Conversation

@sbaerlocher

Copy link
Copy Markdown
Member

Summary

  • Remove var-naming[no-role-prefix] from the skip_list and add profile: production plus strict: true to .ansible-lint.
  • The repository already satisfies the rule, so this locks in the current state rather than fixing a defect. All role registers pass because the rule strips a leading underscore before comparing the prefix, and molecule verify.yml registers sit at play level where the sub-rule cannot apply.
  • No register renames were needed; the change is limited to the lint configuration.

Test plan

  • Baseline run before the change: 0 failure(s), 0 warning(s) on 121 files
  • Positive control: an invalid register name triggers var-naming[pattern]
  • Positive control: an unprefixed register in a role triggers var-naming[no-role-prefix] once the skip entry is removed, and passes silently while it is present
  • Run with the target config: Passed: 0 failure(s), 0 warning(s) on 121 files. Profile 'production' was required, and it passed.
  • yamllint clean on the changed file
  • CI green

Comment thread .ansible-lint
claude[bot]
claude Bot previously approved these changes Aug 9, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lint-config change is correct and safe to merge.

  • Removing var-naming[no-role-prefix] from skip_list is backed by the code: all role-scoped registers and set_fact names are properly prefixed (_tailscale_*, _alloy_*, alloy_ready, do_config_backups, …), the unprefixed vars: blocks (packages_keys, packages_list, …) all attach to ansible.builtin.include_role tasks (excluded from the no-role-prefix check), and molecule verify.yml registers live in playbooks rather than role task files.
  • profile: production + strict: true is a reasonable CI hardening.

Left one non-blocking nit: under strict: true, warnings fail CI, so the warn_list entries effectively behave like a fail_list. Worth a look but not a blocker.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All raised issues have been addressed. No new issues in the delta.

@sbaerlocher

Copy link
Copy Markdown
Member Author

Removed the warn_list in the same PR: under strict: true those two entries would act as a fail_list rather than as warnings. Both rules are meant to be enforced.

The repository already satisfies the rule, so lifting it out of the skip
list locks in the current state instead of fixing a defect.

Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
With `strict: true` ansible-lint exits non-zero on warnings as well, so the
entries in `warn_list` act as a fail_list rather than as warnings. Both rules
are meant to be enforced, so remove the misleading list.

Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
@sbaerlocher
sbaerlocher force-pushed the refactor/var-naming-role-prefix branch from 46db4d4 to 2b13716 Compare August 10, 2026 21:43
@sbaerlocher
sbaerlocher enabled auto-merge (squash) August 10, 2026 21:43

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All raised issues have been addressed.

@sbaerlocher
sbaerlocher merged commit 784f735 into main Aug 10, 2026
29 checks passed
@sbaerlocher
sbaerlocher deleted the refactor/var-naming-role-prefix branch August 10, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant