Adam Shakhabov
Adam Shakhabov

Reputation: 1356

Disable StyleCop's SA1600 rule for internal interfaces

StyleCop.Analyzers: 1.1.118

My stylecop.json:

 {
      "$schema":
        "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
      "settings": {
        "documentationRules": {
          "companyName": "ShapeCrawler",
          "documentInternalElements": false
        }
      }
    }

Sample:

enter image description here

Is it possible to disable "SA1600: Elements should be documented" rule for internal interfaces?

Upvotes: 2

Views: 1463

Answers (2)

Raman Sharma
Raman Sharma

Reputation: 281

Adding "documentExposedElements": false keyvalue pair in your stylecop.json file fix SA1600 issue.

{
  // ACTION REQUIRED: This file was automatically added to your project, but it
  // will not take effect until additional steps are taken to enable it. See the
  // following page for additional information:
  //
  // https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md

  "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
  "settings": {
    "documentationRules": {
      "companyName": "PlaceholderCompany",
      "documentExposedElements":  false //Add this
    }
  }
}

I hope this helps.

Upvotes: 0

Mike Hofer
Mike Hofer

Reputation: 17022

By definition, internal interfaces are visible to all types within the assembly, and any assemblies that have a "friend" relationship with it via the InternalsVisibleTo attribute. It's generally a good idea to document public members of internal types (including interfaces) unless you have a truly compelling reason not to; at the very least, you'll benefit from IntelliSense documentation at the point of call.

Having said that, if you're determined not to document them, wrap the type in the following:

#pragma warning disable 1591
[Your code here]
#pragma warning enable 1591

Upvotes: 1

Related Questions