1

1st, lets be clear that bracing style is mostly taste only - that is, if a team decides on a certain taste, who am I to question that (within reason).

The problem is then when you use tools like StyleCop (btw. are there actually any other C# tools like StyleCop? I have the impression its rather singular in the C# ecosystem?)

StyleCop, by default, enforces a certain bracing style, the one in question I found is: CurlyBracketsForMultiLineStatementsMustNotShareLine, i.e. it enforces

void bla()
{
  return x;
}

instead of

void bla() {
  return x;
}

The team, however, would really like to stick to the second style.

The question I ask myself is now:

  • Can I get Stylecop to validate the other rule, instead of just disabling the rule?
  • Are we shooting ourselves in the foot by deviating from the StyleCop recommendation?
Community
  • 1
  • 1
Martin Ba
  • 37,187
  • 33
  • 183
  • 337
  • 1
    Not supported, according to [this Stylecop issue](http://stylecop.codeplex.com/workitem/6693). I couldn't find a K&R ruleset after a brief Google, but maybe it's out there somewhere? – Patrick Quirk Nov 11 '14 at 13:27

1 Answers1

1

Thanks to Patrick:

The style referred to in the question is mostly K&R indentation style and there is a StyleCop issue 6693 that is closed with the message:

Closed Aug 17, 2010 at 11:17 PM by jasonall

StyleCop does not comply with the K&R style. It would be difficult to tweak the rules to partially support this style. A better option would be for a third-party dev to create an alternate K&R ruleset.

So it is simply not supported.

Benjamin Hodgson
  • 42,952
  • 15
  • 108
  • 157
Martin Ba
  • 37,187
  • 33
  • 183
  • 337