Skip to content

Throws a error with a valid config even on invalid commit #290

@dalisoft

Description

@dalisoft

Describe the bug

Throws a error linting commit with a valid config. All values copied or adopted from https://keisukeyamashita.github.io/commitlint-rs/rules/scope-format/ (or other rules pages).

Even invalid commit messages are passing and getting into commits history

Config

rules:
  body-empty:
    level: warning
  body-max-length:
    level: error
    length: 128
  description-empty:
    level: error
  description-format:
    level: error
    format: ^[a-z]*$
  description-max-length:
    level: error
    length: 64
  scope:
    level: warning
    options:
      - binary
      - script
      - ci
      - dependencies
  scope-empty:
    level: warning
  scope-format:
    level: error
    format: ^[a-z]*$
  scope-max-length:
    level: warning
    length: 12
  subject-empty:
    level: error
  type:
    level: error
    options:
      - build
      - chore
      - ci
      - docs
      - feat
      - fix
      - perf
      - refactor
      - revert
      - style
      - test
  type-empty:
    level: error
  type-format:
    level: error
    format: ^[a-z].*$
  type-max-length:
    level: error
    length: 8

Error message

thread 'tokio-runtime-worker' panicked at src/rule/scope_format.rs:34:56:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
task 9 panicked
Rust backtrace
echo "fax it works" | RUST_BACKTRACE=full ./node_modules/.bin/commitlint
thread 'tokio-runtime-worker' panicked at src/rule/scope_format.rs:34:56:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:        0x102975498 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb478ebbfb46e27ce
   1:        0x102992484 - core::fmt::write::he4d5fa2daff1f531
   2:        0x102973124 - std::io::Write::write_fmt::hc5a47a68eba63d9f
   3:        0x1029752cc - std::sys_common::backtrace::print::h79bd952cc5812e7a
   4:        0x102976858 - std::panicking::default_hook::{{closure}}::h82301f6222887737
   5:        0x1029765a0 - std::panicking::default_hook::h1e49abbb3f1d7dbf
   6:        0x102976ca0 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d
   7:        0x102976b68 - std::panicking::begin_panic_handler::{{closure}}::h399e32952efd26a4
   8:        0x10297591c - std::sys_common::backtrace::__rust_end_short_backtrace::h2ab87f841a2323e7
   9:        0x10297691c - _rust_begin_unwind
  10:        0x1029a347c - core::panicking::panic_fmt::h33e40d2a93cab78f
  11:        0x1029a3504 - core::panicking::panic::h57fd475c037a9df3
  12:        0x1028496e8 - <commitlint::rule::scope_format::ScopeFormat as commitlint::rule::Rule>::validate::h54b992e431bf65f7
  13:        0x10284bc18 - commitlint::rule::Rules::validate::hc8d452352f2ca64b
  14:        0x10283bce4 - commitlint::main::{{closure}}::{{closure}}::{{closure}}::h0eadfcb17fc6e2bf
  15:        0x10283b3e8 - tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut::h9ec27cbfa5b77715
  16:        0x102856b50 - tokio::runtime::task::core::Core<T,S>::poll::hd60a48e6479122ad
  17:        0x10285711c - tokio::runtime::task::harness::Harness<T,S>::poll::h8c68a5d1b8f100c4
  18:        0x102894258 - tokio::runtime::scheduler::multi_thread::worker::Context::run_task::h198908025791c6c8
  19:        0x102893250 - tokio::runtime::scheduler::multi_thread::worker::Context::run::h73f3ca2f22c174a9
  20:        0x1028808a0 - tokio::runtime::context::set_scheduler::ha5c7a747e24f4fd7
  21:        0x1028980a8 - tokio::runtime::context::runtime::enter_runtime::had91e8d9ae31044f
  22:        0x102892df4 - tokio::runtime::scheduler::multi_thread::worker::run::h0204a5b0b9cd70aa
  23:        0x10288f5dc - <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll::h67f0fb997e73aae4
  24:        0x10287e92c - tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut::h872efb493ac06ee7
  25:        0x10288ed70 - tokio::runtime::task::core::Core<T,S>::poll::h4beaab8a711983c3
  26:        0x10287dac4 - tokio::runtime::task::harness::Harness<T,S>::poll::h30c72338416aa75e
  27:        0x102884c44 - tokio::runtime::blocking::pool::Inner::run::ha8ba16a05b54a752
  28:        0x10288a998 - std::sys_common::backtrace::__rust_begin_short_backtrace::h78a60ed77f6abb69
  29:        0x10288e540 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h9f86e628e389e2ef
  30:        0x10297a86c - std::sys::unix::thread::Thread::new::thread_start::h8dda2af345bab446
  31:        0x183ce6f94 - __pthread_joiner_wake
task 9 panicked

Expected behavior

Validate commit, not skip invalid commits

Version

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

Additional context

Add any other context about the problem here.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions