Custom Rule Suppressions

Jun 15, 2012 at 8:38 AM
Edited Jun 15, 2012 at 8:38 AM

I am trying to get Stylecop to suppress a couple of rules using the SuppressMessage attribute.

 

 [SuppressMessage("OurCompany.StyleCopRules.LayoutRules", "CD1001:LineMustNotBeTooLong")]
 [SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1005:SingleLineCommentsMustBeginWithSingleSpace")]

 

Of these two suppressions, the second one works fine. The first one however is a custom rule.

The rule is in a class called LayoutRules, in a namespace called OurCompany.StyleCopRules, built into an assembly named OurCompany,StyleCopRules.dll.

The FullName of the type is OurCompany.StyleCopRules.LayoutRules, as this seems to be what Stylecop uses to match up with the SuppressMessage attribute.

I can't understand why it doesn't work. Any ideas on what I might be doing wrong?

Coordinator
Jun 15, 2012 at 12:15 PM
I've just checked in the code and that appears fine.

Can you open a bug and attach the rules dll and your sample using it and I'll debug and fix it.


~A.

On 15 Jun 2012, at 09:38, daveflett <notifications@codeplex.com> wrote:

From: daveflett

I am trying to get Stylecop to suppress a couple of rules using the SuppressMessage attribute.

        [SuppressMessage("OurCompany.StyleCopRules.LayoutRules", "CD1001:LineMustNotBeTooLong")]
        [SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1005:SingleLineCommentsMustBeginWithSingleSpace")]

Of these two suppressions, the second one works fine. The first one however is a custom rule.

The rule is in a class called LayoutRules, in a namespace called OurCompany.StyleCopRules, built into an assembly named OurCompany,StyleCopRules.dll.

The FullName of the type is OurCompany.StyleCopRules.LayoutRules, as this seems to be what Stylecop uses to match up with the SuppressMessage attribute.

I can't understand why it doesn't work. Any ideas on what I might be doing wrong?