Martin Ba
Martin Ba

Reputation: 38795

StyleCop rule for different bracing style instead of just disabling it?

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:

Upvotes: 1

Views: 384

Answers (1)

Martin Ba
Martin Ba

Reputation: 38795

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.

Upvotes: 1

Related Questions