stylecop

Adding GNU GPL Licence to C# App

I know how to do this but I don't know is the StyleCop method true/working. Normally in StyleCop rules you must add this thing like this example to header (need to edit): //----------------------------------------------------------------------- // <copyright file="Widget.cs" company="Sprocket Enterprises"> // Copyright (c) Sprocket ...

StyleCop vs DependencyProperties

I always tend to group all stuff that belongs to a dependency property (registration, clr property, change callback, coerce callback etc.) into one region. But this violates the stylecop member ordering rules. This is also a general problem with codesnippets that generate multiple members, since the snippets can not generate code at diff...

StyleCop vs ReSharper and general coding-style questions

Just found StyleCop, looks like something worth using for my projects. Then I found out you could use it with ReSharper (a tool I've also never used). So I downloaded ReSharper, as well as StyleCop for ReSharper. I'm just a bit confused about it, though: With just StyleCop installed (no ReSharper), I get yelled at for referring directl...

Why does StyleCop recommend prefixing method or property calls with "this"?

I have been trying to follow StyleCop's guidelines on a project, to see if the resulting code was better in the end. Most rules are reasonable or a matter of opinion on coding standard, but there is one rule which puzzles me, because I haven't seen anyone else recommend it, and because I don't see a clear benefit to it: SA1101: The c...

How to configure StyleCop to suppress warnings on generated code?

Another project, Visual Studio's Code Analysis has this option. But I couldn't find it for StyleCop (AKA Source Analysis). The file I want to ignore is a dbml's .designer.cs code, that includes the // <autogenerated> tag. A blog post tells me that it would be sufficient, but in my case it is not. ...

StyleCop SA1636 rule firing when it should not

We are using Resharper 4.5 and StyleCop 4.3. We have a project with many .CS files in it. All .CS files have valid headers, as defined by our StyleCop settings, and added automatically by Resharper's Insert/replace header action. Four of the .CS files receive a SA1636 warning. The copyright text exactly matches the declared copyright...

Can I create custom rules in StyleCop without coding anything?

Hi there. Can anybody confirm or deny that I can modify default styles provided by StyleCop by just modifying some configuration file? ...

Creating a plugin for Visual Studio

I'm a fan of style cop but hate the way it dosn't have a more producticve way of resolving errors. So I'm thinking, to give me a wee project to keep me happy in my spare time, of creating a Visual studio plugin to automate some error fixing. Has anyone authored a plug in before and got any useful links, hints, experience to share? ...

Disable StyleCop for specific lines

We're using StyleCop in our C# projects. In some cases we'd like to avoid the rules though. I know you can add // <auto-generated /> in the beginning of the file to make StyleCop ignore it. However, I don't want to ignore the rules for the whole file - only a block of code within it. Can I disable StyleCop for specific lines somehow? ...

StyleCop for ReSharper

I like stylecop and we use it to enforce coding standards. I dont like the fact that there is no way to automatically fix problems. So was thinking of making a plugin. Once I realised that 2010 is better for doing this I backtracked. I've been looking for an existing tool to help automate this process and have come across stylecop for ...

StyleCop Visual Studio Snippets

I'm looking for some Visual Studio snippets for implementing style cop rules. For instance when style cop returns an error saying my code needs a documentation header it would be useful to have a snippet that creates this header for me. Has anyone got any snippets for implementing resolution to stylecop rules? ...

Is there a planned StyleCop release for VS 2010 ?

Does anyone know when stylecop will be released to integrate into VS2010. I know you can tweak the config files to integrate it at the moment, but it is not possible to view the UI. ...

Why is StyleCop SA1305 not respecting the allowed prefixes list in VS2010?

I just upgraded a project from 2008 to 2010 Beta 2 and StyleCop is now reporting SA1305 (Hungarian notation) warnings on variable names with the prefix 'is'. 'Is' is definitely in the list of allowed prefixes. Is this a known issue? Has anyone else run across this problem? The code was definitely compiling without any warnings in 2008. ...

Setting up StyleCop for team development

We are trying to setup stylecop for a team development environment. So far what we have done is: Checked the files into source control Create an environment variable on every machine that points to that location (each dev has source checked out to a different location, this solves that) Add the tag to the project as follows: This w...

How to sort using statement of C# code in vim?

Recently I edit C# code in vim. And the build system has StyleCop enabled so that all using statement should be in alphabetical order. So, I tried to select below lines of code in visual mode, then type ":sort". using System.Security.Permissions; using System.Runtime.Serialization; using System.Security; using System.ServiceModel; Th...

Stylecop vs FXcop

Has Stylecop superseded FXcop? Which product should we be using with Visual Studio 2008? ...

Is it possible to run StyleCop on just 1 file in a project?

Is it possible to run StyleCop on just 1 file in a project? ...

C# Is this initialiser really redundant?

I have the following line of code: var dmrReceived = new DownloadMessagesReport(); StyleCop and ReSharper are suggesting I remove the redundant initializer. However if I replace it with DownloadMessagesReport dmrReceived; surely this will generate an object reference not set to an instance of an object? I am using .NET 3.5. Do you...

Why shouldn't I prefix member variables in StyleCop?

StyleCop just informed me that I shouldn't be prefixing member variables with m_. Is that the offical line on c# coding styles? I guess so as its from MS. Does anyone know anything about this?? By default, StyleCop disallows the use of underscores, m_, etc., to mark local class fields, in favor of the ‘this.’ prefix. The advantage of...

StyleCop Suppression

Is it possible to suppress StyleCop rules in a more global what... in other words not just using source in-line attributes? ...