Skip to content

fix(analyzers): ignore partial type parts for RCS1060 - #1798

Merged
josefpihrt merged 8 commits into
mainfrom
fix/analyzers/rcs1060-partial
Aug 14, 2026
Merged

fix(analyzers): ignore partial type parts for RCS1060#1798
josefpihrt merged 8 commits into
mainfrom
fix/analyzers/rcs1060-partial

Conversation

@josefpihrt

Copy link
Copy Markdown
Collaborator

Summary

  • Group type declarations by name within each namespace scope when counting types in a file.
  • Skip additional partial declarations of an already-seen type so multiple partial parts of the same type do not trigger RCS1060.
  • Add tests for the issue repro, partial + distinct type regression, and file-scoped namespace.

Fixes #1779

Test plan

  • dotnet test src/Tests/Analyzers.Tests --filter FullyQualifiedName~RCS1060

Made with Cursor

josefpihrt and others added 2 commits August 9, 2026 16:40
Skip additional partial declarations of the same type when counting
types in a compilation unit so interface-only partial parts do not
trigger declare-each-type-in-separate-file diagnostics.

Fixes #1779

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@josefpihrt josefpihrt left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review notes for the RCS1060 partial-type fix. The approach matches #1779 well (count distinct types, not every partial part), with one correctness gap around generic arity.

Comment thread src/Analyzers/CSharp/Analysis/DeclareEachTypeInSeparateFileAnalyzer.cs Outdated
Comment thread src/Analyzers/CSharp/Analysis/DeclareEachTypeInSeparateFileAnalyzer.cs Outdated
Josef Pihrt and others added 6 commits August 14, 2026 19:30
Partial types with the same name but different type-parameter counts are distinct types and should still trigger DeclareEachTypeInSeparateFile.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…stinct type

Most namespaces never collide on name+arity; skip extra partial parts of the first type without a HashSet.

Co-authored-by: Cursor <cursoragent@cursor.com>
Satisfy RCS1050 in the lazy type-key set initializer.

Co-authored-by: Cursor <cursoragent@cursor.com>
Skip the diagnostic only when a file (or its single namespace) contains
nothing but multiple partial declarations of one type, leaving the
existing type-counting loop untouched.

Co-authored-by: Cursor <cursoragent@cursor.com>
@josefpihrt
josefpihrt merged commit a1eb4b5 into main Aug 14, 2026
17 checks passed
@josefpihrt
josefpihrt deleted the fix/analyzers/rcs1060-partial branch August 14, 2026 21:12
This was referenced Aug 16, 2026
This was referenced Aug 20, 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.

RCS1060 fires for partial classes in the same file

1 participant