feat: support regex matching for package name overrides#2658
feat: support regex matching for package name overrides#2658majiayu000 wants to merge 2 commits intogoogle:mainfrom
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
G-Rath
left a comment
There was a problem hiding this comment.
looks pretty good, though we should update the documentation to reflect the new property and add a CLI test for an invalid regex to showcase the output
|
Thanks for the review! I've addressed the feedback:
|
Add a `nameIsRegex` boolean field to PackageOverrideEntry. When true, the `name` field is compiled as a regex (anchored with ^...$) and matched against the normalized package name. Invalid regex patterns are handled gracefully with a warning and treated as non-matching. Uses the existing cachedregexp.Compile() utility for performance. Signed-off-by: majiayu000 <[email protected]>
- Move regex validation from matches() to tryLoadConfig() so invalid regex patterns are caught once at load time instead of warning per package - Add documentation for nameIsRegex property in docs/configuration.md - Add CLI test for invalid regex config with snapshot Signed-off-by: majiayu000 <[email protected]>
06e9395 to
04e14ad
Compare
|
Hi @G-Rath, I've rebased onto the latest main and addressed the feedback:
Could you please re-review when you get a chance? Thanks! |
Fixes #151
Changes
Adds a
NameIsRegexboolean field (nameIsRegexin TOML) toPackageOverrideEntry. When set totrue, theNamefield is treated as a regex pattern instead of an exact string match.cachedregexp.Compile()for efficient cached compilation^...$to prevent partial matchesnameIsRegex = false) is unchangedExample config:
Test Plan
Added
TestConfig_ShouldIgnorePackage_NameIsRegexwith 8 test cases:nameIsRegex = false