KeisukeYamashita / commitlint-rs

🔦 Lint commit messages with conventional commit messages
https://keisukeyamashita.github.io/commitlint-rs
Apache License 2.0
32 stars 8 forks source link

The "format" rules panic #255

Closed cengels closed 8 months ago

cengels commented 8 months ago

Describe the bug

What I did:

  1. Added a simple config (see below) consisting only of the example config on the description format page.
  2. Ran the command commitlint --from HEAD~1 --to HEAD~1 in a repository with existing commits
  3. Received the error below.

The same error also occurs with the "type format" and "scope format" rules. I tried changing the format regex a few times, but no matter the regex, the error always remained the same. After removing the configuration for the "description format" rule (and optionally adding a bunch of other rules), the error went away.

Config

rules:
  description-format:
    level: error
    format: ^[A-Z].*$

Error message

thread 'tokio-runtime-worker' panicked at /.cargo/registry/src/index.crates.io-6f17d22bba15001f/commitlint-rs-0.1.6/src/rule/description_format.rs:34:62:
called `Option::unwrap()` on a `None` value

Expected behavior

No error.

Version

# Run the following command
$ commitlint --version
commitlint-rs 0.1.6

Additional context

N/A

KeisukeYamashita commented 8 months ago

Thank you very much for your report! I guess this issue has been fixed in this PR → https://github.com/KeisukeYamashita/commitlint-rs/pull/269

If I have misunderstood, please let me know! Thanks ⭐

cengels commented 8 months ago

I tested this in 0.1.8 and can confirm format rules no longer panic! Nice work.