Ignore promises in S3735 void-use

There seems to be a regression in v10+ (according to other users), I am on v10.5.1 and the void-use rule does not honor the exception for promises. This seems to be the exact same issue that was reported in v8 here:

And fixed here:

  • What language is this for?
    • Typescript
  • Which rule?
    • S3735
  • Why do you believe it’s a false-positive/false-negative?
    • Because it’s listed in your exceptions
  • Are you using
    • SonarQube - v10.5.1
  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
const myPromiseFunc = () => Promise.resolve()
void myPromiseFunc() // Falsely triggers S3735 rule
1 Like

Hello @dbuhrman,

I can’t reproduce that with the snippet you provided. That rule depends on properly configuring the project’s tsconfig.json, as it uses Typescript to check if the voided argument is actually a Promise.

Please check the analysis logs to ensure that the project tsconfig.json is well detected and actually includes the file where this issue is being raised.

I did check that when no tsconfig.json is found, the rule indeed raises an issue.

Cheers,
Victor