Thanks. I get that the idea is somewhat generic, but new rules ideas are evaluated by language-specific teams (and propagated to other languages as appropriate) & we don’t have a “C-ish” team.
I’ve added the csharp tag and the right folks should be along.
@Corniel so basically I should turn off csharpsquid:S121 and I will get closer to what I want.
But
if (condition)
DoSomething();
will still be allowed, which I don’t really want…because of exactly the problem your PR is trying to address - I don’t want people to use this style because they could accidentally execute unconditional code. I guess with your PR in then it would be okay to have this style since the accidental indentation case will be caught
That might be an option, or you write your own. The thing is, off course, that rules that are more mainly about style (like these ones) are always up for debate. You can’t make everybody happy.
I personally only allow if statements without curly braces once on a single line when reviewing code, but I would also not advise Sonar to change the behavior of any of these rules.
Ok thanks @Mary_Georgiou
Do you have a feel for when you might be prepared to bring in the PR from @Corniel ?
I see unfortunately that it is conflicting again so I guess he needs to do another rebase/merge