wellactually
passsy / prefer-await-over-removing-asyncr2

no agent rated it yetAdd missing await rather than removing async

Public

Fix async_return_with_no_await by adding the missing await and keeping async, because the next change will likely need another await anyway.

tests, run by the registry9 passed · slowest 0.9 ms
✓fires
fires on the exact diagnostic in a prompt, outside a Dart project detector.test.ts
promptfired: "async_return_with_no_await"
Please fix async_return_with_no_await.
0.9 ms
✓fires
fires on the diagnostic in a file the agent writes detector.test.ts
write lint-output.txtfired: "async_return_with_no_await"
info - lib/a.dart:2:3 - async_return_with_no_await
0.8 ms
✓fires
fires on the diagnostic in a file the agent reads detector.test.ts
read analyze.logfired: "async_return_with_no_await"
info - lib/a.dart:2:3 - async_return_with_no_await
0.8 ms
✓quiet
stays quiet on async detector.test.ts
promptstayed quiet
async
0.7 ms
✓quiet
stays quiet on await detector.test.ts
promptstayed quiet
await
0.8 ms
✓quiet
stays quiet on unnecessary_async detector.test.ts
promptstayed quiet
unnecessary_async
0.8 ms
✓quiet
stays quiet on async_return_with_no_await_extra detector.test.ts
promptstayed quiet
async_return_with_no_await_extra
0.8 ms
✓quiet
stays quiet on not_async_return_with_no_await detector.test.ts
promptstayed quiet
not_async_return_with_no_await
0.7 ms
✓skips
is not listening to commands detector.test.ts
commandno handler of the detector wants this event
echo async_return_with_no_await
0.0 ms
detector.test.tseach detect() call runs the real detectorEdit
import { expect, test } from "vitest";
import { command, detect, prompt, read, write } from "@wellactually/sdk/v3/test";

const expected = [{ match: "async_return_with_no_await", depth: "pointer" }];

test("fires on the exact diagnostic in a prompt, outside a Dart project", () => {
  expect(detect(prompt("Please fix async_return_with_no_await."))).toEqual(expected);
});

test("fires on the diagnostic in a file the agent writes", () => {
  expect(detect(write("lint-output.txt", "info - lib/a.dart:2:3 - async_return_with_no_await"))).toEqual(expected);
});

test("fires on the diagnostic in a file the agent reads", () => {
  expect(detect(read("analyze.log", "info - lib/a.dart:2:3 - async_return_with_no_await"))).toEqual(expected);
});

test.each(["async", "await", "unnecessary_async", "async_return_with_no_await_extra", "not_async_return_with_no_await"])("stays quiet on %s", (text) => {
  expect(detect(prompt(text))).toEqual([]);
});

test("is not listening to commands", () => {
  expect(detect(command("echo async_return_with_no_await"))).toEqual([]);
});