-
Notifications
You must be signed in to change notification settings - Fork 660
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
max-tasks: Limit the number of tasks in a task file #2172
Comments
I'll work on this one. |
This is no longer recommended explicitly by the way: https://github.com/redhat-cop/automation-good-practices/tree/main/coding_style It only reads
There is no specific number of tasks given. |
@MarkusTeufelberger As part of the implementation for this rule, we will gather some data from all content published on public hub and find a suitable value that is very unlikely to be hit by normal usage. Also, the rule could be disabled by the user anyway. This could be seen as related to pylint too-complex rule which is based on mccable cyclomatic complexity, something that does not really apply to ansible content. I suspect the number will be somewhere between 40-100. Also the plan is to limit the number of tasks per block level (top level could also be considered a level, so you might have more tasks than the limit inside a single file without hitting the rule if they are nested. Still, final implementation is still subject to discussions so any feedback is more than welcomed here. IMHO, we should be able to look at bad players once we can count the complexity and decide if the rule works or not based on rate of false positives. If we discover that only ~50% of long tasks files should really be split in other files, we will not do the rule. But if more than 80% are and less than 20% are false positives, we might have a case for keeping it. |
Lets try an first implementation checking for 100 tasks, user configurable and counted per file (not inside each branch). |
Starting to pull in possible rule ideas from the community of practice: redhat-cop/automation-good-practices#64
Limiting the total number of tasks in a single task file would encourage the use of includes, possibly leading to more reusable discrete tasks.
This would also add to the readability of the task files as each would have a file name indicating the summary action it performs.
30 was thrown in here as an idea, it could be higher, but I think having it too low would move the complexity to the file system.
The text was updated successfully, but these errors were encountered: