Skip to content
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

Add rule to forbid asyncio.create_task #15774

Open
Tinche opened this issue Jan 27, 2025 · 1 comment
Open

Add rule to forbid asyncio.create_task #15774

Tinche opened this issue Jan 27, 2025 · 1 comment
Labels
rule Implementing or modifying a lint rule wish Not on the current roadmap; maybe in the future

Comments

@Tinche
Copy link

Tinche commented Jan 27, 2025

Description

I'd like to enforce structured concurrency in my codebases, and a rule to forbid asyncio.create_task would be very helpful, since it would enforce all tasks are managed through TaskGroups.

This is likely to be controversial and spawn false positives so I think it should probably be disabled by default. Obviously it's possible to achieve structured concurrency even with asyncio.create_task, but I would argue you'd just be reimplementing TaskGroups.

Still, for some codebases I think a rule like this would be very useful.

@AlexWaygood
Copy link
Member

I can see the appeal. Unfortunately I think this is probably much too opinionated to be done until we recategorize our ruleset so that we can better distinguish highly opinionated, restrictive rules like this one from rules that nearly everybody would probably want enabled :( See #1774 for the recategorisation issue

@AlexWaygood AlexWaygood added rule Implementing or modifying a lint rule wish Not on the current roadmap; maybe in the future labels Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule wish Not on the current roadmap; maybe in the future
Projects
None yet
Development

No branches or pull requests

2 participants