Skip to content
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

regular expression support #450

Open
scarf005 opened this issue Nov 5, 2023 · 4 comments
Open

regular expression support #450

scarf005 opened this issue Nov 5, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@scarf005
Copy link
Contributor

scarf005 commented Nov 5, 2023

hi, i'd like to apply conventional PR titles for our project, and thought it'd be neat to define valid scopes by regex. for example:

scopes:
  - 'mods/(\w+)'

would match titles such as

feat(mods/foo): ...
feat(mods/bar): ...

i'm interested in opening a PR for this feature.

relevent lines:

const isScopeValid = !scopes || !scope || scope.split(',').every(scope => scopes.includes(scope));
const isTypeValid = (types.length > 0 ? types : commitTypes).includes(type);

@Ezard
Copy link
Owner

Ezard commented Jan 7, 2024

Hey @scarf005, this is a neat idea, but do you have any thoughts on how to determine whether a scope that a user has provided is a regex or not?

Maybe as well as the scopes array, there could also be a scopeRegexes array? This would prevent non-regex scopes from accidentally being parsed as regexes

Do you have any thoughts on this, or suggestions for a better way of handling it?

@Ezard Ezard added the enhancement New feature or request label Jan 7, 2024
@scarf005
Copy link
Contributor Author

scarf005 commented Jan 7, 2024

i think scopeRrgexes could work

@hsundar-git
Copy link

@Ezard Any plans to implement this? I am also looking for regex support for scopes.

@Ezard
Copy link
Owner

Ezard commented Dec 29, 2024

Had a think about this today, and unfortunately allowing users to specify their own regexes opens things up for abuse (there are some things that you can do with regexes that require loads of computational power; see here for examples)

I would be open to something a bit more constrained though, e.g.

scopes:
  - mods:
      allowChildren: true

or something like this, if that would be suitable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants