Skip to content

SA1601: only require documentation on one part of a partial type - #4308

Merged
AArnott merged 4 commits into
masterfrom
aarnott-sa1601-partial-docs-one-part
Oct 14, 2026
Merged

AArnott merged 4 commits into
masterfrom
aarnott-sa1601-partial-docs-one-part

Conversation

@AArnott

@AArnott AArnott commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

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.

  • The other parts are only inspected (via the type symbol's declaring syntax references) after the current part is found undocumented, so the common documented path costs nothing extra.
  • Added tests for docs on the first part, on a later part, and on no part (class, struct, interface).
  • Updated the rule remarks and documentation/SA1601.md. The <content> tag guidance is kept as a recommendation.
  • No new setting; this changes the default behavior.

SA1600 is unchanged: it still skips partial declarations and defers to SA1601.

Fixes #4176

Fixes #4176

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@AArnott
AArnott marked this pull request as ready for review October 14, 2026 19:41
Copilot AI balanced review requested due to automatic review settings October 14, 2026 19:41
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 19:44
AArnott and others added 2 commits October 14, 2026 13:45
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The existing C# 15 partial-union test still expects a diagnostic that the new behavior suppresses.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 14, 2026 19:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused implementation, regression expectations, and documentation are consistent, with no unresolved blocking findings; tests were not run during this review.

0 open findings

🧠 Review effort: Balanced

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.45455% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.62%. Comparing base (3674a47) to head (ccc77c4).

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This was referenced Nov 24, 2026
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

Successfully merging this pull request may close these issues.

SA1601: consider requiring documentation on only one part of a partial type

2 participants