stylecop

Looking for Stylecop-perfect comments for `protected override void Dispose(bool disposing)`.

I know, StyleCop is not perfect, but we try to use it in a helpful way. I do like the fact that it complains about undocumented arguments. Now, for properties and constructors it recommends what the text should be, but it does not help with Dispose method, and I think it should. We have many classes that implement IDisposable. In this pa...

How to enforce documentation of private methods in StyleCop?

Our team has some code guidelines that I would like to enforce via stylecop rules. For most of the things a Settings.Stylecop file is used. However, I would like to enforce documentation for private methods and I can not find the way to do this in the Settings file. If I right-click on a project and select "stylecop settings", I can unch...

In C#, is there a way to enforce use of "this/base" qualification in instance members?

Sometimes it can be confusing reading code in instance members that refers to other instance members of the same class (or a base class): public void MyMethod() { Where = did + AllTheseWeirdThings(GetDeclared()); // ? } Having a coding standard something like "prefix all private/protected members with "_" doesn't help, because ins...

ReSharper cleans our code and changes the using directives so that StyleCop rule SA1200 fails. What to do?

If I use the Code Cleanup ReSharper feature I get this start of a file: using System.Web.UI; [assembly: WebResource("Company.Web.Resources.foo.js", "application/x-javascript")] namespace SiteSeeker.Web.WebControls { using System; using System.Collections.Specialized; using System.Reflection; using System.Web; using...

Resharper: Code Style Sharing - Enforcing

We have a team of 40+ engineers working on a common code base. We're using resharper, and have been sharing our suggested settings by having a 'definitive' configuration file emailed out which people can import. However, as time goes on we wish to tighten up on various things on new versions and new work, without requiring refactoring o...

StyleCop in MSBuild script. How make it output file only and no warnings or errors during build

Hi! I am using StyleCop 4.4.0 RTW. I have installed it, copied the contents to a version controlled directory and I've added it to each of my project files by simply adding this line to each .csproj-file: <Import Project="..\Library\StyleCop\v4.4\Microsoft.StyleCop.targets" /> The basic functionality seems to work. When I Build a pro...

StyleCop - auto sorting type members

Hi, is there any plugin for Resharper or VS extensions for auto sorting class/struct members as suggested by StyleCop? I.e. something which sorts public, protected, then private properties, then public, protected, private methods? ...

C# StyleCop - Using "this." prefix for base class members like current class members or not?

StyleCop has a rule about using "this." prefix to calling class members (SA1101). Is this rule holds true about a member (for example a method) of a class which is inherited from its base class. Example: class BaseClass { protected void F1() { ... } } class ChildClass : BaseClass { protected void F2() ...

XML code documentation checking using Visual Studio 2010 Code Analysis

I use Visual Studio 2010 Premium Code Analysis (CA) capabilities and force them at every compile with my projects while also showing warnings as errors, so I keep my code nice and well... better. But. Since this CA is very nice and all I wouldn't want to use StyleCop as well. Because StyleCop gives me code style specification that CA d...

Split Stylecop rule SA1600

I like to split the SA1600 stylecop rule but how to do it? Right now it scans for undocumented classes, constructors, delegates, enums, events, finalizers, indexers, interfaces, methods, properties, and structs. I like to disable the warnings of some of them. ...

style cop + resharper control comments

this may seem like a trivial question but when i installed the stylecop plugin for resharper my comments are getting formatted like this /// <summary> /// Gets the gift item. /// </summary> /// <param name="uid"> /// The uid. /// </param> /// <param name="upc"> /// The upc. /// </param> /// <returns> /// </returns> Gift GetGift(long uid...

Should a local const variable start with Upper or lower casing

Got a style conflict between StyleCop and Resharper. Stylecop 1303 says that const vars should start uppercase and I agree. Resharper says OK for class-wide const declarations, but when using a const in a local (e.g. method) scope, Reshaper doesn't approve and wants to make everything camelCasing. Of course no problem to disable this r...

StyleCop: a complete document

I am sorry for asking a dull question. I'd like to provide StyleCop as a default code review tool in the company I am working for. StyleCop is a great tool, but the question is: is there a complete document that describe the code convention rules StyleCop based on? Not a list of warnings, but readable set of rules and explanations. T...

StyleCopCmd: Run StyleCopCmd with StyleCop 4.4.*

Hi Everybody, Is there a way to run StyleCopCmd with StyleCop 4.4.*? I have tried to simply exchange to old stylecop assemblies with the new ones but this leads to an exception that the assembly with the specific version 4.3.0.8 could not be loaded. Is there a hack? Thanks in advance. ...

Is there a stylecop equivalent for Ruby?

StyleCop is a tool that analyzes C# source code to enforce a set of style and consistency rules. Is there anything similar for the Ruby language? ...