stylecop

Is there a standard ReSharper code style definition that matches all the StyleCop requirements?

The ReSharper reformat code feature is very handy and flexible, particularly with the new code layout templating flexibility JetBrains have added in version 3.0. Is there a standard set of code style settings for ReSharper which match the rules enforced by Microsoft StyleCop, so that StyleCop compliance can be as easy as running the ReS...

Can FxCop/StyleCop be limited to only analyze selected methods from with Visual Studio?

I am taking on a maintenance team and would like to introduce tools like FxCop and StyleCop to help improve the code and introduce the developers to better programming techniques and standards. Since we are maintaining code and not making significant enhancements, we will probably only deal with a couple of methods/routines at a time whe...

Should Usings be inside or outside the namespace

I have been running StyleCop over some C# code and it keeps reporting that my using statements should be inside the namespace. Is there a technical reason for putting the using statements inside instead of outside the namespace? Edit: There appears that there is no difference after compliation. The reasons for putting them inside the n...

Why is new .NET code from Microsoft not Microsoft StyleCop compliant?

I just downloaded the ASP.NET MVC beta and the templates are not StyleCop compliant. Why is new .NET code coming from Microsoft not StyleCop compliant? ...

Which are the bare minimum source files that I should upload to a CodePlex project?

I'm looking to revamp an old open source project I've started a couple of months ago. I'm a tidiness fanatic, I really try hard to "code like a girl" whenever I can. That's why I've been policing my code with StyleCop, which makes me really happy. Now for some reason I've got the feeling that I've uploaded a pile of junk back then with t...

Alternative to StyleCop for Visual Studio?

I like StyleCop's static code analysis and rules enforcement. However, it is severely lacking in several key departments. Adding new rules isn't officially supported and from what I hear pretty difficult. Automatic "fixing" of trivial rules violations would be nice! Perhaps not with variable naming but with method ordering (static,...

How can I find methods without an explicit access modifier?

I am using FxCop and I would like to find all the methods or variables without an access modifier explicitly defined. For example: class MyClass { int myInt = 0; internal MyClass() { } } I would like FxCop to warn me that I didn't specify what access modifier will be applied to the variable "myInt" or the class "MyClass"....

Visual Studio C#-settings and StyleCop (MS Source Analysis)

Does anyone have settings for Visual Studio, in XML or a .vssettings-file, that is compatible with StyleCop? I've used the book Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries for guidance on what Microsoft finds to be the correct way to format C# and set my Visual Studio-settings accordingly. ...

Which StyleCop rules should I follow when writing a open source library.

I am currently writing an open source wrapper for a COM object. I have just installed StyleCop and run it against some of my code, and as I expected it threw up a load of warnings (some of which I should have been doing already eg adding "this." to all local method calls and variables) How many of these warnings should I try and reduce...

What's a possible justification for not wrapping long argument lists? (StyleCop SA1115)

I'm stuck in a battle between ReSharper and StyleCop, and I'd like to let ReSharper win, but I want to hear the arguments in favour of StyleCop before I do that. When I'm writing long argument lists ReSharper sensibly chops the parameter list and restarts it on the next line. I find that much more readable. When I run StyleCop over the...

Run StyleCop against iis based Web Project on buildserver

Hi, How do I run stylecop against an iis based webproject on a buildserver? Buildserver runs in continuous integration and I would like this automated. With a library I can add a few lines to the .csproj and its done. I believe it to be a website application project. Thanks, Nath ...

How do you resolve the discrepancy between "StyleCop C# style" and "Framework Design Guidelines C# style"?

After going through the Appendix A, "C# Coding Style Conventions" of the great book "Framework Design Guidelines" (2nd edition from November 2008), I am quite confused as to what coding style is Microsoft using internally / recommending. The blog entry A Brief History Of C# Style claims: In fact, the differences between the "StyleCo...

Has anyone created any cool rules for FxCop/StyleCop?

I'm just looking for some inspiration. Especially in the area of performance and security, naming conventions are important but not as 'cool' ;) Even if your rule was only applicable to your domain/project but demonstrates how powerful a rule can be, please let me know. I work with C#, but I'm interested in rules for any language. ...

Is there a downloadable document available that encapsulates the core rules enforced by StyleCop?

Is there a downloadable document available that encapsulates the core rules enforced by StyleCop? We've settled on C#, and we're going to be using FxCop and StyleCop to enforce design and style guidelines. To help get folks ramped up to speed, we'd like to make sure they have printed versions of the reference materials on hand as casua...

Best way to integrate StyleCop with TFS CI

I've been doing research on how to enable source analysis for the project I'm working on and plan to use StyleCop. The setup I have is a TFS Server for source control, using TFS Continuous Integration. I want to enable source analysis for CI builds and daily builds run on the build machine, and not only for those run on developers' machi...

Visual Studio Code Analysis vs StyleCop + FxCop

I used previously StyleCop + FxCop on my Visual Studio's projects. But now I am testing Visual Studio Code Analysis tool, which is easier to integrate into MSBuild, and I have found that this tools analyses some of the rules of both FxCop and StyleCop. Is this tool a full replacement for both FxCop and StyleCop or it just implements som...

Unit testing custom StyleCop rules

I'm wondering what's the best way to go about unit testing custom SytleCop rules. I've read this but am hoping there's a better solution. Thanks. ...

How can you force StyleCop for ReSharper to ignore files?

We’ve just been working on introducing StyleCop to our team and are using the StyleCop ReSharper plugin from Code Plex. Problem is, every single file in the project appears to be getting analysed and we can’t find a way to exclude particular files. This includes files such as the designer.cs file from the DBML or third party components i...

Disabling StyleCop rules

I'm using StyleCop. But there a couple of rules I want to ignore, for instance using this. in front of class members. How do I turn off a StyleCop rule. I've looked but can't find how to do it. ...

StyleCop for other languages

Hi, weve been using StyleCop for enforcing coding standards in C#, I was wondering are there similar tools for other languages? namely: js css sql ...