-
Notifications
You must be signed in to change notification settings - Fork 249
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
Lint on unawaited futures #731
Comments
Related to discarded_futures: dart-lang/sdk#58889 |
Expanding on that: Zixuan and I looked at the output of this lint rule yesterday, and found that it probably won't make sense for us to turn it on.
|
This brings the file test/api/core_test.dart up to being clean against the `unawaited_futures` lint rule, toward zulip#731. It does so with a smaller diff, and simpler resulting code, than by adding `await` on each of the futures. For comparison: zulip#934 (comment)
This brings the file test/api/core_test.dart up to being clean against the `unawaited_futures` lint rule, toward zulip#731. It does so with a smaller diff, and simpler resulting code, than by adding `await` on each of the futures. For comparison: zulip#934 (comment)
This brings the file test/api/core_test.dart up to being clean against the `unawaited_futures` lint rule, toward zulip#731. It does so with a smaller diff, and simpler resulting code, than by adding `await` on each of the futures. For comparison: zulip#934 (comment)
This brings the file test/api/core_test.dart up to being clean against the `unawaited_futures` lint rule, toward zulip#731. It does so with a smaller diff, and simpler resulting code, than by adding `await` on each of the futures. For comparison: zulip#934 (comment)
Partially fixes: zulip#731 Signed-off-by: Zixuan James Li <zixuan@zulip.com>
Fixes-partly: zulip#731 Signed-off-by: Zixuan James Li <zixuan@zulip.com>
Fixes-partly: zulip#731 Signed-off-by: Zixuan James Li <zixuan@zulip.com>
Fixes-partly: zulip#731 Signed-off-by: Zixuan James Li <zixuan@zulip.com>
Fixes-partly: zulip#731 Signed-off-by: Zixuan James Li <zixuan@zulip.com>
Fixes-partly: zulip#731 Signed-off-by: Zixuan James Li <zixuan@zulip.com>
Fixes-partly: zulip#731 Signed-off-by: Zixuan James Li <zixuan@zulip.com>
Fixes-partly: zulip#731 Signed-off-by: Zixuan James Li <zixuan@zulip.com>
Fixes-partly: zulip#731 Signed-off-by: Zixuan James Li <zixuan@zulip.com>
We resolved a large swath of this issue with dart-lang/linter#934, enabling the The remaining task that's open here is to cover the cases where the unawaited future's enclosing function body isn't already marked with So in order to make progress on the remaining part of this issue, what's needed is a new lint rule (or changes to With that, I think there's nothing further for us to do on this but wait and hope somebody takes that on. (In principle we could dig into the Dart linter codebase and attempt to contribute a rule ourselves. Maybe at some point in the future we'll do that. But I think this particular desired rule isn't important enough to us to justify that level of investment, and certainly not to do so in the near future.) So, moving this to our furthest-off milestone, "post-launch". |
There's a pair of lint rules in the Dart analyzer that detect when we have a Future and neglect to await it:
https://dart.dev/tools/linter-rules/unawaited_futures
https://dart.dev/tools/linter-rules/discarded_futures
(Despite the name,
unawaited_futures
doesn't cover one major class of unawaited futures: those where the enclosing function isn't evenasync
. Those are covered bydiscarded_futures
.)It'd be good to enable those. The bugs they catch can be pretty subtle otherwise.
The text was updated successfully, but these errors were encountered: