Ignore unmatched :ignore attributes#49
Ignore unmatched :ignore attributes#49egil merged 7 commits intoAngleSharp:develfrom RiRiSharp:feature/#48
:ignore attributes#49Conversation
:ignore attributes
|
Let me know what you think, I loved how everything is set up, code looks very clean. But maybe my changes could be better placed somewhere else, let me know! |
There was a problem hiding this comment.
Maybe revert this change?
There was a problem hiding this comment.
Or maybe merge the two files into one static file, e.g. IgnoreAttributeStrategy.cs, have the Compare and Match methods in the static class, and then have the static IsIgnoreAttribute method there being shared.
There was a problem hiding this comment.
Do we need to keep IgnoreAttributeComparer for backwards compatibility?
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where unmatched :ignore attributes were not being properly handled by the diffing engine. Previously, :ignore attributes that didn't have corresponding attributes in the test HTML would still cause diff failures instead of being ignored as intended.
- Added a new
IgnoreAttributeMatcherto handle unmatched:ignoreattributes by matching them with themselves - Refactored
IgnoreAttributeComparerto extract ignore attribute detection logic into a reusable method - Added comprehensive test coverage for various scenarios with
:ignoreattributes
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| IgnoreAttributeMatcher.cs | New matcher strategy that handles unmatched :ignore attributes by self-matching |
| IgnoreAttributeComparer.cs | Refactored to extract ignore attribute detection into a reusable method |
| DiffingStrategyPipelineBuilderExtensions.cs | Integrated the new ignore attribute matcher into the pipeline |
| SourceMap.cs | Updated to use extracted method for unmatched attribute detection |
| HtmlDifferenceEngine.cs | Added necessary using statement for attribute strategies |
| IgnoreAttributeTestData.cs | New test data class with comprehensive test cases for ignore attribute scenarios |
| DiffBuilderTest.cs | Added test methods to verify ignore attribute functionality works correctly |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/AngleSharp.Diffing/Strategies/AttributeStrategies/IgnoreAttributeComparer.cs
Outdated
Show resolved
Hide resolved
|
I have:
|
|
Thanks, I think looks good. Lets ignore the failing Linux build for now. Asked Copilot to change that in a separate PR. |
This reverts commit 2597558.
It was nice contributing! If there are ever open issues and you don't have time, let me know. |
egil
left a comment
There was a problem hiding this comment.
Thanks, lets get this merged.
This repository does not have a lot. Feel free to look over the code base, see if there are things that needs updating, e.g. new html elements or Boolean attributes that are counted as boolean. Otherwise, we would love help over in the bUnit repository. |
Types of Changes
Prerequisites
Please make sure you can check the following two boxes:
Contribution Type
What types of changes does your code introduce? Put an
xin all the boxes that apply:Description
Closes #48