Skip to content

Add MA0197 to disallow inheritdoc on types#1138

Merged
meziantou merged 3 commits into
mainfrom
meziantou/inheritdoc-rule-plan
May 7, 2026
Merged

Add MA0197 to disallow inheritdoc on types#1138
meziantou merged 3 commits into
mainfrom
meziantou/inheritdoc-rule-plan

Conversation

@meziantou

Copy link
Copy Markdown
Owner

This adds a project-style rule for <inheritdoc> usage: allow it on members, but report it on type declarations.

The motivation is to enforce a members-only documentation inheritance style without changing MA0196's existing behavior.

What changed

  • Added MA0197 (InheritdocShouldNotBeUsedOnTypes) and implemented a new analyzer on SymbolKind.NamedType.
  • Kept MA0196 unchanged so it remains focused on non-inheriting members.
  • Added tests covering class/interface usage, partial declarations, member usage, and cref cases.
  • Added docs/Rules/MA0197.md and updated docs/comparison-with-other-analyzers.md.
  • Regenerated analyzer docs and packaged editorconfig files.

Notes for reviewers

  • This behavior is intentionally stricter than official <inheritdoc> guidance and stricter than SA1648 for inheriting types.
  • MA0197 reports type-level <inheritdoc> even when cref is present, by design for this style policy.

meziantou and others added 3 commits May 7, 2026 12:35
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@meziantou meziantou merged commit 6a1b0f5 into main May 7, 2026
13 checks passed
@meziantou meziantou deleted the meziantou/inheritdoc-rule-plan branch May 7, 2026 17:22
This was referenced May 7, 2026
This was referenced Jun 9, 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.

1 participant