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

bug: convco commit allows invalid scopes #145

Closed
cafkafk opened this issue Sep 18, 2023 · 9 comments
Closed

bug: convco commit allows invalid scopes #145

cafkafk opened this issue Sep 18, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@cafkafk
Copy link

cafkafk commented Sep 18, 2023

Describe the bug
convco commit allows committing with an invalid scope.

From conventional commits:

  1. A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., fix(parser):

2023-09-18_18-45

To Reproduce
not relevant

Expected behavior
Convco should not allow spaces in scopes, as that would make the scope not a noun which it MUST be.

System (please complete the following information):
not relevant

Additional context
None I can think of.

@cafkafk cafkafk added the bug Something isn't working label Sep 18, 2023
@cafkafk
Copy link
Author

cafkafk commented Sep 18, 2023

I suspect it might be this regex that would have to be changed

scope_regex: "[[:alnum:]]+(?:[-_/][[:alnum:]]+)*".into(),

@hdevalke
Copy link
Collaborator

hdevalke commented Sep 18, 2023

AFK. But this regex does not allow spaces, but maybe needs to have a start ^ and end $ marker.

You could change the regex in the config file. The regex is allowing dashes, slashes and underscores, but not spaces.

@cafkafk
Copy link
Author

cafkafk commented Sep 18, 2023

You could change the regex in the config file. The regex is allowing dashes, slashes and underscores, but not spaces.

Would you want me to PR this or just fix it locally?

@hdevalke
Copy link
Collaborator

A PR is nice, I can confirm that it is the issue, but a local fix will be faster, unless you build your own binary from it.

❯ convco check -c <(cat <<< 'scopeRegex: "^[[:alnum:]]+(?:[-_/][[:alnum:]]+)*$"') --from-stdin <<< 'chore(a b): bump deps'; echo $?
could not find repository from '.'; class=Repository (6); code=NotFound (-3)
FAIL  -  scope does not match regex: ^[[:alnum:]]+(?:[-_/][[:alnum:]]+)*$  chore(a b): bump deps
1

~ 
❯ convco check -c <(cat <<< 'scopeRegex: "[[:alnum:]]+(?:[-_/][[:alnum:]]+)*"') --from-stdin <<< 'chore(a b): bump deps'; echo $?
could not find repository from '.'; class=Repository (6); code=NotFound (-3)
0

@hdevalke
Copy link
Collaborator

@cafkafk I did create a PR, if the checks are green I will merge this soon. But I won't have the time to create a release this week.

@Hoverbear
Copy link

@hdevalke any chance you're planning to cut a release with this fix soon? It would be nice to include this fix in nixpkgs without going to an unstable version.

@hdevalke
Copy link
Collaborator

hdevalke commented Oct 3, 2023

I will release it this evening.

@hdevalke
Copy link
Collaborator

hdevalke commented Oct 3, 2023

@Hoverbear v0.4.3 has been released.

@Hoverbear
Copy link

Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants