Unbounded parallel calls
This is how the comment reads inline, under the flagged line.
Why it matters
Unbounded fan-out exhausts connection pools, trips rate limits and can take down the service it calls.
What to do
Cap concurrency (p-limit, a semaphore, batches).
Examples
await Promise.all(ids.map((id) => fetchUser(id)));
await mapLimit(ids, 8, fetchUser);
What it catches
It reads a pattern on each line, aware of strings and comments. Languages: TypeScript and JavaScript, Python. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.
Flagged
await Promise.all(ids.map((id) => get(id)));
src/app.py
await asyncio.gather(*[f(x) for x in xs])
Left alone
await mapLimit(ids, 8, get);
Research
`Promise.all(items.map(...))` or `gather(*...)` with no limit. Thousands of calls at once exhaust pools and trip rate limits.
Turn it off or change it
In a config file for the CLI, or in the API's rules field:
{
"rules": {
"disable": [
"unbounded-fanout"
],
"severity": {
"unbounded-fanout": "medium"
}
}
}
Promise.all(ids.mapstarts one call per item, all at once. With 10,000 items that's 10,000 open requests.