stylecop

custom static code analysis rules in fxcop or stylecop?

if writing my own static code analysis rules (for C# code), what are the pros and cons of using stylecop vs fxcop? is one more appropriate for certain type of analysis than the other? or is the difference between the two that one runs on the source code and the other on the compiled assembly? ...

Automatic StyleCop

StyleCop is an awesome little add-on for visual studio. But it doesn't show you live hints or provide any automated fixes. Along comes reSharper and StyleCop for reSharper, this is the ideal solution, however it costs too much. Is there an open source way to achieve the live code hints and automated fixes for style cop? Or is reShar...

Is there a way to enforce using tabs instead of spaces?

StyleCop offers to check for consistent use of spaces, but sadly lacks the opposite idea: Force source code to use tabs. Is there some way to add this functionality? It does not have to be StyleCop, other tools are welcome as well. ...

How to integrate StyleCop into Tfs 2010

Hi, I need to run StyleCop rules check when gatecheckin into tfs2010. But I dont know how to configure this. Please help. ...

Re-enabling stylecop

Hi, I think i may have accidently disabled stylecop in my Visual Studio 2008 enviroment. If i right click a project and click "Run Stylecop", or "Stylecop Settings" nothing happens. Its the same from the Tools menu. It runs fine from Visual Studio 2005. I have Microsoft StyleCop 4.3.3.0. I was playing about with making custom rules and...

Enforce custom stylecop rules for a checkin policy on TFS

Hi, I have installed StyleCop CheckIn policy (from here) and it works great. However I have written some custom rules which I want to be enforced as part of the CheckIn policy (Visual Studio 2008, Team Explorer 2008, TFS 2005). The custom rules appear fine in the settings file when I right click on a project and click "StyleCop Setti...

StyleCop MS Build magic? Who is calling the StyleCop target?

In our project files we are using StyleCop and are running it during the build process. We've modified our project files to include the StyleCop targets like so: <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.t...

StyleCop SA1638

I am using StyleCop in VS2008. I get this error: SA1638: The file attribute in the file header's copyright tag must contain the name of the file. Here is my header. // <copyright file="AssemblyInfo.cs" company="company"> // Copyright (c) company. All rights reserved. // </copyright> // <author>me</author> // <email>[email protected]</email> /...

Is there CI server software that can do all of this?

I'm trying to put together a Continuous Integration server that will do the following: Work with subversion Use NUnit tests (fail build on failed tests) Use partcover (fail build on < X% coverage) Run code against FxCop (fail build on FxCop warnings, given settings) Run code against StyleCop (fail build on StyleCop warnings, given sett...

StyleCop SA1124 DoNotUseRegions is reasonable?

SA1124 DoNotUseRegions suggest that region should not be used anywhere. Is it really reasonable? I think region is a way to group relative code together and make large class easy to read, for example, if you generate interface method in for class, a region will be automatically inserted by visual studio. I would like to remove this ...

StyleCop XML Documentation Header - Using 3 /// instead of 2 //

I am using XML documentation headers on my c# files to pass the StyleCop rule SA1633. Currently, I have to use the 2 slash commenting rule to allow StyleCop to recognize the header. for example: // <copyright file="abc.ascx.cs" company="MyCompany.com"> // MyCompany.com. All rights reserved. // </copyright> // <author>Me</author> ...

Integrate StyleCop in NAnt buildscript

Is there a way to integrate StyleCop in a NAnt script such that the build fails if there are too many style violations? There doesn't seem to be a NAnt task for StyleCop, but we've found StyleCopCmd. However this only seems to generate an XML file as output that we'd have to parse. Is there some easier solution? ...

Stylecop - Determine if Double or Float

I'm using Stylecop to come up with some custom rules and I'm trying to determine if I have a double or a float. I'm able to walk through the statement and get a CSTokenType. The CSTokenType is number and can be read as a string. But since it's just a Number I have no real way of knowing if it's an int, float , long , double or whate...

C# Checked exceptions

One feature I really liked in Java that isn't in C# is checked exceptions. Is there any way to simulate (maybe via stylecop?) or turn on checked exceptions in Visual Studio? Yes I know a lot of people dislike them, but I find they can be helpful. ...

Trying to suppress StyleCop message SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine

I am trying to suppress the following StyleCop message for a specific property: SA1513: Statements or elements wrapped in curly brackets must be followed by a blank line. I am trying to do the following, but it doesn't seem to work: [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1513:ClosingCurlyBracketMustBe...

Need a C# Assembly to reference a strongly named assembly loosely.

So here's the problem. I'm writing some StyleCop plug-in assemblies for use at the company I work for. As such, these assemblies need to reference Microsoft.StyleCop.CSharp.dll for example, which is strongly named. The problem comes in that if I build this and pass it along to the developers in my group, they must have the same versio...

Filtering warnings in Visual studio 2008

Hello, I opened up a huge Solution in VS2008. I has about a little over a thousand style cop warnings. I don't have resharper or any other commercial visual studio add-ins. Is there any way I can filter the warnings, so I can just look at the items pertaining to one file (the current file)? I could sort by filename and scroll to th...

Has Anyone Customized StyleCop rules based on the IDesign Coding Standard?

Has Anyone Customized StyleCop rules based on the IDesign Coding Standard? ...

How did your team customize Stylecop (and perhaps other tools) for .Net for a good result?

Our team is still in a love / hate relationship with it. I am hoping to put an end to the debate by having an internal vote on what rules should be excluded and which rules should be added. Before doing so, I wanted to ask others SO users. To standardize (but not limit) the responses: What is your current StyleCop version? What .Net v...

How can I make VS2010 insert using statements in the order dictated by StyleCop rules.

The related default StyleCop rules are: Place using statements inside namespace. Sort using statements alphabetically. But ... System using come first (still trying to figure out if that means just using System; or using System[.*];). So, my use case: I find a bug and decide that I need to at least add an intelligible Assert to mak...