This project is read-only.

Is SA1200 really appropriate?

Oct 27, 2014 at 12:22 AM
The justification given for SA1200 notwithstanding, it nevertheless represents a stark contradiction against VS item templates and the very strong majority of source code found today.

I personally have come to accept SA1200 but I find it a constant battle with others -- and one that lately I've been losing. Is this really a style that's worth keeping? Yes there are effects between the two styles (using directives appearing inside vs outside namespace blocks) but they rarely matter and if the world is ever to agree on a style, why not start with a guide based on what most (well written) code uses? (even if a small % of "even better" code does something different)
Oct 29, 2014 at 5:46 PM
I'm agree on the fact that it's not easy to respect when VS item templates aren't going in the same direction.

However, if you use Resharper, you could quickly create resharper templates that match this rule, and educate a team to use those templates (it works for mine)

And for teams that doesn't want this rule, it's easy to deactivate it. But it presence by default, at least make them think about a "better" way to write code than what most people do actually.

For me it's a good rule, and I expect from a tool like stylecop to guide me toward good practices, not necessarily toward common practices.

But an intermediate solution could be to add in an hypothetical next version of stylecop a notion of setting profiles
which helps you to choose a set of settings based on what you search by using stylecop ("VS Style", "Best practices Style", etc.)

Indirectly this notion of profiles is something that we already do in our team with nuget packages that deploy settings to activate or not stylecop rules based on the type of project (standard project, unit test project, web project)
Nov 7, 2014 at 1:08 AM
Thanks for the thoughtful response.
Nov 12, 2014 at 7:54 PM
A set of templates (with clear instructions on how to apply them) to replace the default Visual Studio ones would be greatly appreciated.