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

Discarded futures are not reported in code analysis #1366

Open
limwa opened this issue Oct 19, 2024 · 2 comments
Open

Discarded futures are not reported in code analysis #1366

limwa opened this issue Oct 19, 2024 · 2 comments

Comments

@limwa
Copy link
Member

limwa commented Oct 19, 2024

This does bring another question to mind: don't we have a "unawaited_futures" lint enabled? If yes, why wasn't this caught earlier?

Originally posted by @limwa in #1365 (comment)

The reason the problem was not caught earlier is that the unawaited_futures lint only applies to async functions. To have the same effect in non-async functions, we can try enabling the discarded_futures in the code analysis and check if the problems reported by it are real problems or not (in other words, check if the lint rule is effective on our codebase).

@limwa
Copy link
Member Author

limwa commented Oct 19, 2024

Upon further analysis, discarded_futures would not catch the error in #1365, so I'm not sure what else we can do...

@limwa
Copy link
Member Author

limwa commented Oct 19, 2024

I have created an issue in the Dart issue tracker to see if this is an issue they are looking to fix in the Dart analyzer or not. If they are interested in having it fixed, I can look into contributing an update to the lint rules with a PR to the Dart SDK.

The issue is available here: dart-lang/sdk#56921

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Product Backlog
Development

No branches or pull requests

1 participant