Repository navigation
chore: Generate regular expressions at compile time - #1821
Conversation
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. WalkthroughThe pull request centralizes regex patterns in generated and lazy providers. Existing builder, Dockerfile, image, and K3s code now uses these providers. ChangesRegex Pattern Centralization
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Refactor Possibly related PRs
Merge Risk:
|
What does this PR do?
Moves the regular expressions with a constant pattern into an internal
RegexPatternsclass per project (core, K3s, Commons). On .NET 7 and later they use[GeneratedRegex], on .NET Standard they fall back to a lazily createdRegexinstance. Call sites now use, e.g.,RegexPatterns.ComposeProjectName().IsMatch(...).Why is it important?
Removing the match timeouts in #1820 surfaced 12 SonarCloud SYSLIB1045 issues. Source-generated regular expressions resolve them and avoid parsing (and for the image reference pattern,
RegexOptions.Compiledemitting) the regular expressions at runtime.Related issues
Summary by CodeRabbit