Skip to content

Conversation

@SimonCropp
Copy link
Member

No description provided.

@SimonCropp SimonCropp requested a review from Copilot November 29, 2025 09:41
Copilot finished reviewing on behalf of SimonCropp November 29, 2025 09:45
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 refactors the cross-chunk matching logic used by various scrubbers (GuidScrubber, DateScrubber, DirectoryReplacements) into a shared, reusable utility class called CrossChunkMatcher. This eliminates code duplication and provides a consistent approach for matching and replacing patterns that may span across StringBuilder chunk boundaries.

Key Changes

  • Introduced CrossChunkMatcher class that provides generic pattern matching across StringBuilder chunks
  • Refactored GuidScrubber to use the new CrossChunkMatcher infrastructure
  • Refactored DateScrubber to use the new CrossChunkMatcher infrastructure
  • Refactored DirectoryReplacements_StringBuilder to use the new CrossChunkMatcher infrastructure

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
CrossChunkMatcher.cs New shared utility class for matching patterns across StringBuilder chunk boundaries; provides generic ReplaceAll method with callbacks for cross-chunk and within-chunk matching
GuidScrubber.cs Refactored to use CrossChunkMatcher; removed duplicate FindMatches logic and internal Match struct
DateScrubber.cs Refactored to use CrossChunkMatcher; replaced ReplaceFixedLength and ReplaceVariableLength methods with CrossChunkMatcher callbacks; renamed parameter from tryConvertDate to tryConvert for consistency
DirectoryReplacements_StringBuilder.cs Refactored to use CrossChunkMatcher; moved FindMatches logic into callbacks; introduced MatchContext class to encapsulate matching state

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +13 to +15
public static void ReplaceAll<TContext>(
StringBuilder builder,
int maxLength,
Copy link

Copilot AI Nov 29, 2025

Choose a reason for hiding this comment

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

The XML documentation is missing the maxLength parameter. Add a <param name="maxLength"> tag to document this parameter, e.g., <param name="maxLength">Maximum length of patterns to search for</param>.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Copy link
Member Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Copy link

Copilot AI commented Nov 29, 2025

@SimonCropp I've opened a new pull request, #1651, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI commented Nov 29, 2025

@SimonCropp I've opened a new pull request, #1652, to work on those changes. Once the pull request is ready, I'll request review from you.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants