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

check should fail on unrecognized types #53

Closed
Kissaki opened this issue Jun 15, 2022 · 8 comments
Closed

check should fail on unrecognized types #53

Kissaki opened this issue Jun 15, 2022 · 8 comments
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers

Comments

@Kissaki
Copy link

Kissaki commented Jun 15, 2022

convco check parses the commit information in CommitParser, which verifies the correct message format.

However, the parsed type is never verified to be one of the configured types in Config.

@Kissaki Kissaki added the enhancement New feature or request label Jun 15, 2022
@hdevalke hdevalke added bug Something isn't working good first issue Good for newcomers labels Jun 16, 2022
hdevalke added a commit that referenced this issue Jun 19, 2022
Validate the commit type against the ones defined in config.

Refs: #53
hdevalke added a commit that referenced this issue Jun 19, 2022
Validate the commit type against the ones defined in config.

Refs: #53
@hdevalke
Copy link
Collaborator

For this repo, this is the output:

❯ cargo run -- check
   Compiling convco v0.3.10 (/home/hannes/code/convco)
    Finished dev [unoptimized + debuginfo] target(s) in 3.75s
     Running `target/debug/convco check`
FAIL  38be02d  wrong type: doc  doc: clarify cmake is needed to build
FAIL  8c4dbb6  wrong type: doc  doc: improve gitlab section in `README.m...
FAIL  ffcf34a  scope does not match regex: changelog|check|commit|version  ci(docker): Add a dockerfile
FAIL  724bb2b  first line doesn't match `<type>[optional scope]: <description>`  release v0.3.0
FAIL  155e652  scope does not match regex: changelog|check|commit|version  build(deps): bump versions

5/121 failed

38be02d and 8c4dbb6 are newly detected

@ite-klass
Copy link

Are you saying it’s working/supposed to work like that already?

@hdevalke
Copy link
Collaborator

Are you saying it’s working/supposed to work like that already?

No, that is the output of #55. Before merging it I would like to know if that's what you expected and if the error message is fine.

@Kissaki
Copy link
Author

Kissaki commented Jun 21, 2022

Assuming the exit code is non-0, yes, that seems reasonable.

hdevalke added a commit that referenced this issue Jun 22, 2022
Validate the commit type against the ones defined in config.

Refs: #53
@Kissaki
Copy link
Author

Kissaki commented Jun 23, 2022

Thank you! :)

@prewk
Copy link

prewk commented Apr 23, 2023

Is this still the case?

Shouldn't echo "whatever: Test" | convco check --from-stdin give me an error when using the default configuration because whatever isn't a type?

(Because it doesn't)

@hdevalke
Copy link
Collaborator

The code is indeed only parsing the message, but not checking the types when read from stdin.

@hdevalke hdevalke reopened this Apr 25, 2023
@jbergstroem
Copy link
Contributor

jbergstroem commented May 13, 2023

Shouldn't echo "whatever: Test" | convco check --from-stdin give me an error when using the default configuration because whatever isn't a type?

I assumed this would work without a git repository as well:

$ echo "whatever: Test" | convco check --from-stdin
Error: could not find repository from '.'; class=Repository (6); code=NotFound (-3)

Gonna split this out into a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants