Skip to content

Conversation

@meziantou
Copy link
Owner

No description provided.

@meziantou meziantou requested a review from Copilot May 2, 2025 19:18
Copy link

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 introduces a new analyzer (MA0169) that detects when the equality operators (==, !=) are used on types that override Equals.

  • Added analyzer implementation in src/Meziantou.Analyzer/Rules/UseEqualsMethodInsteadOfOperatorAnalyzer.cs
  • Created corresponding tests in tests/Meziantou.Analyzer.Test/Rules/UseEqualsMethodInsteadOfOperatorAnalyzerTests.cs
  • Updated rule identifiers, documentation, and README files to include the new rule

Reviewed Changes

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

Show a summary per file
File Description
tests/Meziantou.Analyzer.Test/Rules/UseEqualsMethodInsteadOfOperatorAnalyzerTests.cs Adds tests covering various scenarios for the new rule
src/Meziantou.Analyzer/Rules/UseEqualsMethodInsteadOfOperatorAnalyzer.cs Implements the analyzer logic to report diagnostics for improper usage
src/Meziantou.Analyzer/RuleIdentifiers.cs Adds the identifier constant for MA0169
src/Meziantou.Analyzer/Internals/MethodSymbolExtensions.cs Introduces extension methods to support the analyzer’s functionality
docs/Rules/MA0169.md Provides documentation and usage examples for the new rule
docs/README.md, README.md Updates rule tables to reflect the addition of MA0169
Files not reviewed (2)
  • src/Meziantou.Analyzer.Pack/configuration/default.editorconfig: Language not supported
  • src/Meziantou.Analyzer.Pack/configuration/none.editorconfig: Language not supported

@meziantou meziantou requested a review from Copilot May 2, 2025 19:20
Copy link

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 implements a new analyzer (MA0169) to detect when equality operators are used on types that override Equals, suggesting that the Equals method should be used instead. Key changes include the addition of analyzer tests, the new analyzer implementation and updated helper methods, as well as corresponding documentation updates in the docs and README files.

Reviewed Changes

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

Show a summary per file
File Description
tests/Meziantou.Analyzer.Test/Rules/UseEqualsMethodInsteadOfOperatorAnalyzerTests.cs New tests covering various scenarios, including special cases for primitive types and records
src/Meziantou.Analyzer/Rules/UseEqualsMethodInsteadOfOperatorAnalyzer.cs Analyzer implementation to flag equality operator usage when Equals is overridden
src/Meziantou.Analyzer/RuleIdentifiers.cs Addition of new rule identifier MA0169
src/Meziantou.Analyzer/Internals/MethodSymbolExtensions.cs Added extension methods for method symbol comparisons
docs/Rules/MA0169.md & docs/README.md & README.md Documentation updates for the new rule
Files not reviewed (2)
  • src/Meziantou.Analyzer.Pack/configuration/default.editorconfig: Language not supported
  • src/Meziantou.Analyzer.Pack/configuration/none.editorconfig: Language not supported

@meziantou meziantou merged commit ebc62f2 into main May 3, 2025
12 checks passed
@meziantou meziantou deleted the ma0169 branch May 3, 2025 01:29
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.

2 participants