S125 false positive and bad fixer loses line break

Please provide

  • Operating system: Windows 10
  • Visual Studio version: 17.8.6
  • SonarLint plugin version: 7.6.0.83110
  • Programming language you’re coding in: C#
  • Is connected mode used: no
    • Connected to SonarCloud or SonarQube (and which version):

And a thorough description of the problem / question:
Sample code to demonstrate the problem:

                        // If you want to set the timeout per request, use this...
                        // If you're happy with the same timeout for everything, just set the value;
                        // however, not like we did at Christmas.

This incorrectly identifies the 2nd line as a line of commented out code.
And the S125 fixer loses the line break, which turns that into:

                        // If you want to set the timeout per request, use this...                        // however, not like we did at Christmas.

(yes, that really is on one line).

Hi @Richardissimo,

Thanks for reaching out. I can confirm that rule S125 has some issues with sentences that end with some special characters, such as ; and {.
I can also reproduce the issue with the code fix.

I have made a PR reproducing the issue in our here and created an issue in our backlog that will allow you to track our progress in fixing the false positive.

Waiting for the issue to be fixed, you can use #pragma warning disable and #pragma warning restore to locally disable the rule in the source, or the .editorconfig files to disable or change the severity of the rule, if it gets particularly noisy.

Hope it helps,
Antonio