S1066 non-standard syntax

Please provide

  • Operating system: Win 10-64
  • SonarLint plugin version: 7.1.0.75242
  • Programming language you’re coding in: C#, .Net 8
  • Is connected mode used: No

Consider these if statements that should be merged:

if (ixs[cCount] > 1)
{
	if ((control.Options & StandardizeOptions.ThrowInUnexpectedConditions) != 0)
		throw new NotImplementedException("Processing of multiple bracket types is not implemented.");
}

Merging via Ctrl+. produced the following the first time I tried it:

if ((ixs[cCount] > 1) && ((control.Options & StandardizeOptions.ThrowInUnexpectedConditions) != 0))
	throw new NotImplementedException("Processing of multiple bracket types is not implemented.");

However, when I attempted to repeat for the purposes of this post, Sonarlint correctly formatted the parentheses. I was unable to replicate the issue in other attempts, including access via Ctrl+. and the lightbulb.

Hello @IRC!

Thanks a lot for reporting this issue.

It’s a bit misleading the way it looks but this code fix does not come from our products.
It’s part of VS studio code refactoring. See related docs here.

Best regards,
Mary

2 Likes

Hello Mary,

Wow, you are right! It’s hard to tell the difference. Thank you for letting me know.

Best,
Ian

1 Like