Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 8, 2025

Summary

Adds documentation for three new code style rules from the Roslyn repository.

Contributes to #48865.

Files Created

  • ide0360.md - Simplify property accessor (C# 13+)

    • Flags accessors that directly use field keyword: get { return field; }get;
    • Option: csharp_style_prefer_simple_property_accessors
  • ide0370.md - Remove unnecessary suppression

    • Removes unnecessary null-forgiving operators when compiler knows value is not null
    • Example: object o = ""!;object o = "";
  • ide0380.md - Remove unnecessary 'unsafe' modifier

    • Removes unsafe modifier when no pointer operations present

Files Modified

  • index.md - Added entries for the three rules in alphabetical order

All documentation follows existing patterns with proper frontmatter, metadata tables, examples from Roslyn tests, and suppression guidance.

Original prompt

Please add documentation for the code style rules IDE0360, IDE0370, and IDE0380 based on information in the https://github.com/dotnet/roslyn repo. Follow the style of existing code style rule docs, making sure to add the new articles to the TOC and index files.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


Internal previews

📄 File 🔗 Preview link
docs/fundamentals/code-analysis/style-rules/ide0360.md Simplify property accessor (IDE0360)
docs/fundamentals/code-analysis/style-rules/ide0370.md "IDE0370: Remove unnecessary suppression"
docs/fundamentals/code-analysis/style-rules/ide0380.md Remove unnecessary unsafe modifier (IDE0380)
docs/fundamentals/code-analysis/style-rules/index.md docs/fundamentals/code-analysis/style-rules/index
docs/fundamentals/code-analysis/style-rules/language-rules.md Language and unnecessary rules
docs/navigate/tools-diagnostics/toc.yml docs/navigate/tools-diagnostics/toc

Copilot AI self-assigned this Nov 8, 2025
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copilot AI and others added 2 commits November 8, 2025 00:53
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copilot AI changed the title [WIP] Add documentation for code style rules IDE0360, IDE0370, and IDE0380 Add documentation for IDE0360, IDE0370, and IDE0380 code style rules Nov 8, 2025
Copilot AI requested a review from gewarren November 8, 2025 00:58
Copilot finished work on behalf of gewarren November 8, 2025 00:58
@gewarren gewarren marked this pull request as ready for review November 8, 2025 02:24
@gewarren gewarren requested a review from a team as a code owner November 8, 2025 02:24
Copilot AI review requested due to automatic review settings November 8, 2025 02:24
@gewarren gewarren enabled auto-merge (squash) November 8, 2025 02:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds documentation for three new IDE code analysis rules: IDE0360 (Simplify property accessor), IDE0370 (Remove unnecessary suppression), and IDE0380 (Remove unnecessary 'unsafe' modifier). The changes include new rule documentation files, table of contents updates, and index file updates.

Key changes:

  • Three new rule documentation files with examples and configuration guidance.
  • Updates to the TOC to include navigation links for the new rules.
  • Updates to index and language-rules files to list the new rules in appropriate categories.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/navigate/tools-diagnostics/toc.yml Adds TOC entries for IDE0360, IDE0370, and IDE0380
docs/fundamentals/code-analysis/style-rules/language-rules.md Adds references to the new rules in appropriate categories and updates the ms.date
docs/fundamentals/code-analysis/style-rules/index.md Adds table entries for the three new rules with their options
docs/fundamentals/code-analysis/style-rules/ide0380.md New documentation for Remove unnecessary 'unsafe' modifier rule
docs/fundamentals/code-analysis/style-rules/ide0370.md New documentation for Remove unnecessary suppression rule
docs/fundamentals/code-analysis/style-rules/ide0360.md New documentation for Simplify property accessor rule

Comment on lines 263 to +265

C# style rules:

Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

Duplicate section header 'C# style rules:' appears immediately after the .NET style rules section. This creates an incorrect document structure with two separate 'C# style rules:' sections under the same 'Suppression preferences' category. Remove this duplicate header and merge the IDE0370 entry into the existing 'C# style rules:' list on line 264, or if it should be separate, add a descriptive subheading to explain why.

Suggested change
C# style rules:

Copilot uses AI. Check for mistakes.

C# style rules:

- [Remove unnecessary suppression (IDE0370)](ide0370.md)
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

The IDE0370 entry is placed under the 'Suppression preferences' section, but the entry text 'Remove unnecessary suppression' is identical to IDE0079. Consider adding clarifying text to distinguish between the two rules, such as 'Remove unnecessary suppression (null-forgiving operator)' to indicate that IDE0370 specifically handles the ! operator, while IDE0079 handles pragma and SuppressMessage suppressions.

Suggested change
- [Remove unnecessary suppression (IDE0370)](ide0370.md)
- [Remove unnecessary suppression (null-forgiving operator) (IDE0370)](ide0370.md)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants