[Q&A Proposal] Enable unamed-task check in ansible-linter#874
Merged
insatomcat merged 4 commits intoseapath:mainfrom Feb 20, 2026
Merged
[Q&A Proposal] Enable unamed-task check in ansible-linter#874insatomcat merged 4 commits intoseapath:mainfrom
insatomcat merged 4 commits intoseapath:mainfrom
Conversation
Paullgk
requested changes
Feb 20, 2026
added 2 commits
February 20, 2026 14:34
Signed-off-by: Antoine Dupre <antoine.dupre@savoirfairelinux.com>
Signed-off-by: Antoine Dupre <antoine.dupre@savoirfairelinux.com>
77ece85 to
1d0cb08
Compare
Paullgk
previously approved these changes
Feb 20, 2026
insatomcat
previously approved these changes
Feb 20, 2026
added 2 commits
February 20, 2026 15:29
Signed-off-by: Antoine Dupre <antoine.dupre@savoirfairelinux.com>
Signed-off-by: Antoine Dupre <antoine.dupre@savoirfairelinux.com>
8d9dae7
1d0cb08 to
8d9dae7
Compare
insatomcat
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the name[missing] rule from ansible-lint is disabled in the repository.
Rule: All tasks should be named
This rule was originally disabled because it also impacts debugging tasks.
However, disabling it globally is risky. Even if unnamed tasks are currently limited to debug-related usage, nothing guarantees that future changes will not introduce unnamed tasks in production-related code paths.
For maintainability, readability, and safer CI enforcement, this rule should be enabled again.
This proposal:
# noqaexceptionsKeep in mind the mantra:
Why enabling this rule is important
Named tasks provide:
An unnamed task produces generic output such as:
Whereas a properly named task provides context:
Identified cases and proposed handling
Enabling this rule requires handling three specific categories:
1 - Debug tasks
Debug tasks are sometimes intentionally minimal and may not require naming.
Instead of disabling the rule globally, we can explicitly exclude these occurrences with:
# noqa: name[missing]This approach is:
It prevents unintended unnamed tasks from being introduced elsewhere.
2
include_varstasksEven though they look simple, they may:
Because of that, they should always be explicitly named to ensure:
3 Conditional blocks (
when+block)Conditional blocks must be named.
Even if all inner tasks are named, the block itself represents a functional unit.
Without a name, Ansible output becomes less coherent.
Additional lint exceptions
Two additional # noqa annotations were required:
# noqa: var-naming[no-reserved]This is due to the use of the variable name
query, which is considered reserved by ansible-lint.In these two specific cases, the variable name is intentional and valid within our context.
Rather than renaming it globally and risking functional regressions, we explicitly disable the rule for those occurrences only.