DotNetAnalyzers / StyleCopAnalyzers

An implementation of StyleCop rules using the .NET Compiler Platform
MIT License
2.65k stars 508 forks source link

SA1611 not throwing warning for additional parameter in the "private" method if documentation not available for it #3831

Open tejavarma214 opened 5 months ago

tejavarma214 commented 5 months ago

Hi all,

I was facing issue for rule SA1611 not throwing warning for additional parameter in the "private" method if documentation not available for it. But it was showing warning for public/internal method.

SA1611

I was using stylecop analyzer version 1.1.118 and also I tried to use 1.2.xxx but still issue exists ( Working as expected in Version 1.0 )

Can Someone let me know Is this bug in code or any other analyzer handling this rule ?

bjornhellander commented 5 months ago

Have a look at the configuration possibilities: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/Configuration.md#documentation-requirements Specifically documentPrivateElements.

bjornhellander commented 4 months ago

Did you sort it out, @tejavarma214?

SA1611 does not check private methods by default. If you configure it to do so, it would require correct documentation on all private methods.

tejavarma214 commented 4 months ago

@bjornhellander How to enable the rule SA1611 to check for Private methods documentation also ? Can you please let me know the Steps?

bjornhellander commented 4 months ago
  1. Add a stylecop.json file to your project, if you don't have one already. See https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/Configuration.md and https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md on how to do that.
  2. Set documentPrivateElements=true in that file, according to https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/Configuration.md#documentation-requirements

If you didn't have a settings file before, it could look something like this. Otherwise you have to merge this into your existing file.

{
  "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
  "settings": {
    "documentationRules": {
      "documentPrivateElements": true
    },
  }
}