-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(config/validation): validate options which support regex/glob matching #28693
feat(config/validation): validate options which support regex/glob matching #28693
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new field needs to be explained in the docs. Right now it only shows the field in the config options table.
What place should this be added to? |
This is not exposed to users, but rather for internal use to identify options which support the pattern matching feature. Later this can be used to automatically link from these user exposed options to our "pattern matching" docs |
The docs part needs to have some discussion so I will keep this option only for internal use in context of the issue this is PR is related to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs validation added
patternMatch
patternMatch
field
patternMatch
field There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we combine this with other checks that validate the regex is ok?
We have two checks for regex.
For check(1), there isn't any way to combine as it only checks for regex validation only, no glob matching and it is designed for single string rather than an array For check(2), we could make it work if we modify fn to include an if-check for the * or ** logic and expand the return types, to include an extra field say For eg. renovate/lib/util/string-match.ts Lines 26 to 29 in ca23445
true : if the key is matches the patternsfalse : if no match is found or patterns list is empty
New return types: export function matchRegexOrGlobList(
input: string,
patterns: string[],
currentPath?: string,
): { res: boolean; errMsg?: string } Incase we encounter an error say |
@RahulGautamSingh I pushed my suggested change to this branch - wdyt? |
Looks good. I had misunderstood your ask a fair bit :) |
Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
🎉 This PR is included in version 37.341.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Changes
patternMatch
to the config options, which will be used to identify options which support regex/glob matching*
or**
values along with other values.Example: (these are not ok)
Context
Closes: #28554
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via: