Skip to content

Conversation

@aschackmull
Copy link
Contributor

A minor drive-by FP removal improvement.

@aschackmull aschackmull requested a review from a team as a code owner September 16, 2025 08:35
Copilot AI review requested due to automatic review settings September 16, 2025 08:35
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 improves the C# CodeQL query cs/call-to-object-tostring by excluding enum types from the default toString analysis to reduce false positives. Enum types have their own overridden toString implementation that provides meaningful output (the enum value name), so they should not be flagged as using the default Object.toString() method.

  • Excludes enum types from the default toString detection logic
  • Adds a change note documenting the false positive reduction

Reviewed Changes

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

File Description
DefaultToStringQuery.qll Adds exclusion for enum types in the alwaysDefaultToString predicate
2025-09-16-default-tostring-enum.md Documents the improvement in reducing false positives for enum types

@aschackmull
Copy link
Contributor Author

Ignoring irrelevant integration test issues.

@aschackmull aschackmull merged commit 0ceb2f3 into github:main Sep 16, 2025
20 of 22 checks passed
@aschackmull aschackmull deleted the csharp/default-tostring-enum branch September 16, 2025 09:12
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