Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tejavarma214 opened this issue Apr 26, 2024 · 4 comments

Comments

@tejavarma214
Copy link

tejavarma214 commented Apr 26, 2024

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
Copy link
Contributor

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

@sharwell sharwell changed the title #SA1611 not throwing warning for additional parameter in the "private" method if documentation not available for it SA1611 not throwing warning for additional parameter in the "private" method if documentation not available for it Apr 29, 2024
@bjornhellander
Copy link
Contributor

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
Copy link
Author

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

@bjornhellander
Copy link
Contributor

  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
    },
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants