- 
                Notifications
    
You must be signed in to change notification settings  - Fork 707
 
feat: complexity[tasks] for task and handler files #4799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: complexity[tasks] for task and handler files #4799
Conversation
Signed-off-by: Arya Pratap Singh <[email protected]>
| 
           can someone review this @alisonlhart or other maintainers  | 
    
| 
           @ARYPROGRAMMER Can you open an issue for this feature and link it here?  | 
    
          
 hold up surely  | 
    
| 
           here you go @alisonlhart  | 
    
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: