StyleCop : Global Rule Suppression

We want to suppress rules of style cop for all the projects in the developer machine. As you can get few information from the documentation both on global rule setting and rule suppression. Below mentioned are 2 ways to merge them both:

Editing the Settings.StyleCop in notepad

  1. Go to the installation location of StyleCop (possible location: “C:\Program Files\StyleCop 4.7”)
  2. Right click Settings.StyleCop file open with notepad.
  3. Replace below XML Content as a child node of <Analyzer>
  4. <Analyzer
     AnalyzerId="StyleCop.CSharp.DocumentationRules">
      <Rules>
       <Rule Name="ElementsMustBeDocumented">
        <RuleSettings>
         <BooleanProperty Name="Enabled">
            False
         </BooleanProperty>
        </RuleSettings>
       </Rule>
     </Rules>
    </Analyzer>  
  5. The trick to read the above xml can be found here.
  6. Close and Save the file.

Editing the Settings.StyleCop using the default editor

  1. Go to the installation location of StyleCop (possible location: “C:\Program Files\StyleCop 4.7”)
  2. Double click on the file named Settings.StyleCop
  3. The Rule editor will be open (It will look like this)
  4. Simply un-check the rules you don’t want in your projects.
  5. Click Apply and Ok.

Both the solution will give you same result, you can use them as per your convenience.

Advertisement

1 comment

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: