Skip to content

Conversation

@linkdotnet
Copy link
Collaborator

@egil I do think I catched at least one other spot.

@linkdotnet linkdotnet requested review from Copilot and egil December 5, 2025 18:15
@CLAassistant
Copy link

CLAassistant commented Dec 5, 2025

CLA assistant check
All committers have signed the CLA.

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 enhances the HTML comparison engine to properly handle combined comparison decisions using flag-based checks. The core issue being addressed is that when CompareDecision enum has combined flag values (like "Different AND SkipChildren"), the code needs to use HasFlag() rather than equality checks to detect these combinations correctly.

Key Changes:

  • Added three new combined enum values to CompareDecision: DifferentAndSkipChildren, DifferentAndSkipAttributes, and DifferentAndSkipChildrenAndSkipAttributes
  • Updated comparison logic to use HasFlag() instead of equality checks where appropriate
  • Added corresponding static CompareResult instances for the new combined decisions

Reviewed changes

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

Show a summary per file
File Description
CompareDecision.cs Adds three new combined flag enum values to represent scenarios where elements are different but certain comparisons should be skipped
CompareResult.cs Adds static instances for the new combined decisions; updates IsSameOrSkip property to use HasFlag() for proper flag checking; fixes documentation to reference CompareDecision instead of CompareResult
IgnoreChildrenElementComparer.cs Updates early-return check to use HasFlag(); adds switch cases to handle Different and Different|SkipAttributes decisions by returning appropriate combined skip results
IgnoreAttributesElementComparer.cs Adds switch cases to handle Different and DifferentAndSkipChildren decisions by returning appropriate combined skip results
HtmlDifferenceEngine.cs Updates attribute comparison to use HasFlag(CompareDecision.Different) instead of equality check, ensuring it detects differences in combined flag values
IgnoreChildrenElementComparerTest.cs Adds Test004 verifying DifferentDifferentAndSkipChildren transformation; adds Test005 verifying DifferentAndSkipAttributesDifferentAndSkipChildrenAndSkipAttributes transformation
IgnoreAttributesElementComparerTest.cs Adds Test004 verifying DifferentDifferentAndSkipAttributes transformation; adds Test005 verifying DifferentAndSkipChildrenDifferentAndSkipChildrenAndSkipAttributes transformation

Copy link
Collaborator

@egil egil left a comment

Choose a reason for hiding this comment

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

Changed a few other places where HasFlag should be used to check existing compare decision

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

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

CompareDecision.Same => CompareResult.SkipChildren,
CompareDecision.Different => CompareResult.SkipChildren,
CompareDecision.Different => CompareResult.DifferentAndSkipChildren,
CompareDecision.Different | CompareDecision.SkipAttributes => CompareResult.DifferentAndSkipChildrenAndSkipAttributes,
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider using the named enum member CompareDecision.DifferentAndSkipAttributes instead of the inline bitwise OR pattern CompareDecision.Different | CompareDecision.SkipAttributes for consistency with line 27 in IgnoreAttributesElementComparer.cs, which uses CompareDecision.DifferentAndSkipChildren. This would improve code clarity and maintainability.

Suggested change
CompareDecision.Different | CompareDecision.SkipAttributes => CompareResult.DifferentAndSkipChildrenAndSkipAttributes,
CompareDecision.DifferentAndSkipAttributes => CompareResult.DifferentAndSkipChildrenAndSkipAttributes,

Copilot uses AI. Check for mistakes.
@egil egil merged commit 7713289 into devel Dec 6, 2025
11 checks passed
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.

4 participants