Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#3182) Fix rule distinction comparison #3205

Merged
merged 1 commit into from
Jun 8, 2023

Conversation

AdmiringWorm
Copy link
Member

Description Of Changes

When finding the distinct rules that are available in Chocolatey CLI
and its extensions, the equals and GetHashCode was incorrectly
implemented which in some cases causes the incorrect rules to be
returned, or not returned.

This commit updates these two methods to handle the check for
getting the hash code, and comparing immutable rules in the way
that we expect them to behave.

Motivation and Context

To have a functional way to get all available rules in Chocolatey CLI and its extensions.

Testing

  1. Run unit tests.

Operating Systems Testing

  • Windows 10

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v2 compatibility checked?

Related Issue

Fixes #3182

When finding the distinct rules that are available in Chocolatey CLI
and its extensions, the equals and GetHashCode was incorrectly
implemented which in some cases causes the incorrect rules to be
returned, or not returned.

This commit updates these two methods to handle the check for
getting the hash code, and comparing immutable rules in the way
that we expect them to behave.
@AdmiringWorm AdmiringWorm self-assigned this Jun 8, 2023
@AdmiringWorm AdmiringWorm requested a review from corbob June 8, 2023 10:41
Copy link
Member

@corbob corbob left a comment

Choose a reason for hiding this comment

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

LGTM

@corbob corbob merged commit e281fcd into chocolatey:develop Jun 8, 2023
@corbob
Copy link
Member

corbob commented Jun 8, 2023

Thanks for getting this fixed up @AdmiringWorm 👍

@AdmiringWorm AdmiringWorm deleted the immutable-rule-equals branch June 9, 2023 12:17
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.

Incorrect implementation of the RuleIdEqualityComparer.Equals method
2 participants