feat: complexity[tasks] for task and handler files#4799
Draft
ARYPROGRAMMER wants to merge 7 commits intoansible:mainfrom
Draft
feat: complexity[tasks] for task and handler files#4799ARYPROGRAMMER wants to merge 7 commits intoansible:mainfrom
ARYPROGRAMMER wants to merge 7 commits intoansible:mainfrom
Conversation
Signed-off-by: Arya Pratap Singh <notaryasingh@gmail.com>
Author
|
can someone review this @alisonlhart or other maintainers |
Contributor
|
@ARYPROGRAMMER Can you open an issue for this feature and link it here? |
Author
hold up surely |
Author
|
here you go @alisonlhart |
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.
Description
This PR implements the missing
complexity[tasks]functionality for task and handler files that was documented but incompletely implemented in thecomplexityrule.Problem
The
complexity.mddocumentation described acomplexity[tasks]tag that should trigger when the total number of tasks in a file exceeds themax_tasksthreshold. However, this check was never implemented for task files and handler files, only thecomplexity[play]check existed for playbooks.Changes:
The feature validates against the configurable max_tasks threshold
(default: 100) and provides clear, actionable error messages.
Changes
src/ansiblelint/rules/complexity.py- Added matchtasks() override with task countingsrc/ansiblelint/rules/complexity.md- Updated documentation for clarityexamples/playbooks/tasks/rule-complexity-tasks-fail.yml- New test fixture (task file with 6 tasks)Testing
All tests pass: