Skip to content

SA1653: Ignore summary tags in generated partial declarations - #4393

Merged
AArnott merged 3 commits into
masterfrom
fix/sa1653-ignore-generated-summaries
Nov 3, 2026
Merged

AArnott merged 3 commits into
masterfrom
fix/sa1653-ignore-generated-summaries

Conversation

@AArnott

@AArnott AArnott commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • SA1653 no longer counts tags from generated partial declarations (for example WPF *.g.cs / *.g.i.cs) when looking for duplicates, so user-authored docs no longer conflict with generator placeholders.
  • The code fix uses the same generated-document helper and only rewrites non-generated parts; docs updated in en/zh-cn/cs-cz/ru-ru.

Test plan

  • New SA1653 generated-part tests failed on master with the false positive, then passed after the fix
  • FullyQualifiedName~SA1653 passed on StyleCop.Analyzers.Test (C# 6) and Test.CSharp15
  • CI green on this draft before marking ready

WPF and similar generators emit placeholder summaries that falsely conflict with user docs.
@AArnott
AArnott marked this pull request as ready for review November 3, 2026 01:46
Copilot AI balanced review requested due to automatic review settings November 3, 2026 01:46

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

Generated-code detection ignores configuration overrides and source-generated tree origin and mishandles markers, while Fix All can discard nested edits and leave conflicts unresolved.

5 open issues
What changed in this PR

This PR updates SA1653 to ignore summaries in generated partial declarations, preventing WPF-generated placeholders from conflicting with user-authored documentation.

Changes:

  • Shares generated-document detection between the analyzer and code fix.
  • Updates regression tests for generated partials and conflicts between user-authored summaries.
  • Synchronizes the rule documentation across four languages.
File Description
test/​StyleCop.Analyzers.Test/​DocumentationRules/​SA1653UnitTests.cs Adds generated-part scenarios and updates code-fix expectations.
src/​StyleCop.Analyzers/​Helpers/​SyntaxTreeHelpers.cs Adds shared filename and header-based generated-document detection.
src/​StyleCop.Analyzers/​DocumentationRules/​SA1653OnlyOnePartialDeclarationShouldContainSummaryDocumentation.cs Excludes generated declarations when counting summaries.
src/​StyleCop.Analyzers.CodeFixes/​DocumentationRules/​SA1653CodeFixProvider.cs Filters generated declarations from summary edits and enables fixes for remaining conflicts.
documentation/​zh-cn/​SA1653.md Updates Simplified Chinese documentation.
documentation/​SA1653.md Documents the revised generated-part behavior in English.
documentation/​ru-ru/​SA1653.md Updates Russian documentation.
documentation/​cs-cz/​SA1653.md Updates Czech documentation.

Review effort: Balanced

@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.65072% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.63%. Comparing base (a9f5f3d) to head (361383d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4393      +/-   ##
==========================================
- Coverage   97.64%   97.63%   -0.01%     
==========================================
  Files        1348     1349       +1     
  Lines      152728   152904     +176     
  Branches     5258     5267       +9     
==========================================
+ Hits       149126   149295     +169     
- Misses       2274     2280       +6     
- Partials     1328     1329       +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.

Honor generated_code overrides, align markers with Roslyn heuristics, preserve nested Fix All edits, and cover detection paths independently.
Copilot AI balanced review requested due to automatic review settings November 3, 2026 02:19

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

The inherited tests fail on C# 9 and later due to an incompatible options provider, and end-to-end coverage is missing for editorconfig overrides in individual fixes and Fix All.

2 open issues
5 resolved since last review

Review effort: Balanced

The C# 8 AnalyzerConfigOptionsProvider stub lacks GlobalOptions, which breaks derived test hosts on Roslyn 3.8+.
Copilot AI balanced review requested due to automatic review settings November 3, 2026 02:33

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

End-to-end tests are missing for analyzer-config overrides across diagnostics, code fixes, and Fix All, leaving the analyzer and fixer’s per-file option handling unverified.

1 open issue
1 resolved since last review

Review effort: Balanced

@AArnott
AArnott merged commit ed12a4b into master Nov 3, 2026
30 checks passed
@AArnott
AArnott deleted the fix/sa1653-ignore-generated-summaries branch November 3, 2026 03:04
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.

2 participants