Skip to content

Enable CA1067 analyzer and fix violations#15560

Merged
nohwnd merged 2 commits into
microsoft:mainfrom
nohwnd:fix-ca1067
Mar 24, 2026
Merged

Enable CA1067 analyzer and fix violations#15560
nohwnd merged 2 commits into
microsoft:mainfrom
nohwnd:fix-ca1067

Conversation

@nohwnd
Copy link
Copy Markdown
Member

@nohwnd nohwnd commented Mar 24, 2026

Enable the CA1067 analyzer rule (Override Object.Equals when implementing IEquatable) as a warning and fix the single existing violation in OneWayCompatibilityMappingEntry.

Closes #15371

Enable the CA1067 (Override Object.Equals when implementing IEquatable<T>)
analyzer rule as a warning in .editorconfig.

Fix the single violation in OneWayCompatibilityMappingEntry by adding
Equals(object) and GetHashCode() overrides that delegate to the existing
CompatibilityMappingComparer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 24, 2026 06:30
Copy link
Copy Markdown
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

Enables CA1067 as a warning and updates OneWayCompatibilityMappingEntry to properly override object.Equals (and GetHashCode) when implementing IEquatable<T>.

Changes:

  • Enable CA1067 analyzer as a warning via .editorconfig.
  • Add Equals(object?) and GetHashCode() overrides to OneWayCompatibilityMappingEntry.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/OneWayCompatibilityMappingEntry.cs Implements required Equals(object?)/GetHashCode() overrides to satisfy CA1067 and align equality behavior.
.editorconfig Turns on CA1067 at warning severity to enforce the rule repo-wide.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 24, 2026 07:00
@nohwnd nohwnd added the 🚢 Ship it! Add to PRs where owner approves automated PR, but cannot approve because they "wrote it". label Mar 24, 2026
@nohwnd nohwnd enabled auto-merge (squash) March 24, 2026 07:02
Copy link
Copy Markdown
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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚢 Ship it! Add to PRs where owner approves automated PR, but cannot approve because they "wrote it".

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure CA1067 analyzer is enabled

3 participants