Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StyleCop.Analyzers: Disable SA1633 & SA1652

Tags:

stylecop

I have already consulted the configuration documentation, but couldn't find anything.

I want to disable both of the following rules:

SA1633: The file header is missing or not located at the top of the file.
SA1652: Enable XML documentation output.

My stylecop.json looks like this:

{
  "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
  "settings": {
    "orderingRules": {
      "usingDirectivesPlacement": "outsideNamespace"
    }
  }
}

Any ideas?

like image 883
timmkrause Avatar asked Mar 07 '16 06:03

timmkrause


Video Answer


2 Answers

Enabling and disabling rules is done via a ruleset file, not the configuration .json file. For details regarding use of ruleset files, see https://msdn.microsoft.com/en-us/library/dd264996.aspx.

like image 156
Nicole Calinoiu Avatar answered Oct 09 '22 05:10

Nicole Calinoiu


Alternative way is to specify suppression attributes in GlobalSuppressions.cs, like this:

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File must have header", Justification = "<Pending>")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1652:Enable XML documentation output", Justification = "<Pending>")]
like image 21
Maxim Panasyuk Avatar answered Oct 09 '22 04:10

Maxim Panasyuk