Reputation: 4227
Is it possible to get StyleCop to say that this is the correct way to use curly braces?
if (request.Query == string.Empty) {
return SearchResponse.Empty;
}
But not this
if (request.Query == string.Empty)
return SearchResponse.Empty;
Or this:
if (request.Query == string.Empty)
{
return SearchResponse.Empty;
}
I also want this behavior for if, else, else if, while, foreach and for. But not for class declarations or method declarations.
Upvotes: 3
Views: 1097
Reputation: 25652
I don't think it does that out of the box; however, StyleCop ships with an SDK that includes instructions on how to author custom rules. Although it would be most helpful if someone has already created a custom rule accomplishing what you describe, you may find that you must roll your own.
I was going to add a link to the SDK docs, but the .CHM appeared to be broken at the time. You may need to get the whole project from http://stylecop.codeplex.com to read up on details.
Good luck!
Upvotes: 3