FP S3353 - value modified in ref extension method

  • What language is this for? - C#
  • Which rule? - S3353
  • Why do you believe it’s a false-positive/false-negative?
  • Are you using
    • SonarQube Cloud?
    • SonarQube Server / Community Build - which version?
    • SonarQube for IDE - which IDE/version? - VS
      • in connected mode with SonarQube Server / Community Build or SonarQube Cloud?
  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
int bitboard = 0; // FP S3353 - suggestion to add const, which breaks build

bitboard.SetBit(5);

public static int SetBit(this ref int board, int square)
{
    return board |= (1UL << square);
}
1 Like

Hey there

Please fill out this section of the template post. :slight_smile:

I don’t seem to be able to edit the post anymore, but SonarQube ide 8.10.0.11758

Hello @eduherminio,

Thank you for reporting this issue!

I confirm this is a false positive.
I have created a ticket to fix it in a future hardening sprint.

Have a nice day!