Repository navigation
SA1601: only require documentation on one part of a partial type - #4308
Merged
Merged
Conversation
Fixes #4176 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
An existing C# 15 union test still expects a diagnostic that the new behavior suppresses.
1 open finding
What changed in this PR
Aligns SA1601 partial-type documentation requirements with partial members: documenting any one part is sufficient.
Changes:
- Checks other type declarations only when the current part lacks documentation.
- Adds class, struct, and interface tests for documented and undocumented parts.
- Updates rule remarks and English documentation.
| File | Description |
|---|---|
| test/StyleCop.Analyzers.Test/DocumentationRules/SA1601UnitTests.cs | Adds partial-type documentation scenarios. |
| src/StyleCop.Analyzers/DocumentationRules/SA1601PartialElementsMustBeDocumented.cs | Accepts documentation on another type part. |
| documentation/SA1601.md | Explains the new default behavior. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4308 +/- ##
==========================================
- Coverage 97.62% 97.62% -0.01%
==========================================
Files 1308 1308
Lines 142188 142251 +63
Branches 4746 4749 +3
==========================================
+ Hits 138809 138869 +60
- Misses 2154 2156 +2
- Partials 1225 1226 +1 🚀 New features to boost your workflow:
|
This was referenced Nov 11, 2026
Bump StyleCop.Analyzers from 1.2.0-beta.556 to 1.3.180
microsoftgraph/aspnetcore-webhooks-sample#436
Open
Closed
This was referenced Nov 24, 2026
Open
Open
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

SA1601 required a documentation header on every part of a partial type, even though partial members already only need one documented part. This makes types consistent: a part is reported only when no part of the type has documentation. If no part is documented, each part is still reported.
<content>tag guidance is kept as a recommendation.SA1600 is unchanged: it still skips partial declarations and defers to SA1601.
Fixes #4176