Skip to content

A broader version of unawaited_future lint for tests #57604

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

Open
mehmetf opened this issue Jun 29, 2017 · 1 comment
Open

A broader version of unawaited_future lint for tests #57604

mehmetf opened this issue Jun 29, 2017 · 1 comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@mehmetf
Copy link
Contributor

mehmetf commented Jun 29, 2017

We already have this lint that warns you about unawaited futures if you marked your method async. I propose a broader version of this that looks that warns about unuawaited futures without caring about the async tag. It would only apply to tests because it is very rare for a developer to write test code calling async functions where they do not want to wait for the result:

   test('tests something', () {
      var myObj = new MyObj();
      myObj.doSomething(); // It happens to be async
      expect(myObj.someState, 'good');
    });

This code looks perfectly fine and raises no linter alarms. What they meant to write is:

   test('tests something', () async {
      var myObj = new MyObj();
      await myObj.doSomething();
      expect(myObj.someState, 'good');
    });
@pq pq added the type-enhancement A request for a change that isn't a bug label Jun 29, 2018
@parren-google
Copy link

Seems similar to #57653

@srawlins srawlins added the P3 A lower priority bug or feature request label Sep 21, 2022
@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 18, 2024
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

6 participants