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

Feature request: Allow empty scope, but if scope exists must be listed in config #355

Closed scouten-adobe closed 2 weeks ago

scouten-adobe commented 4 weeks ago

I'd like to be able to allow an empty scope, but also restrict the scope to a specific list if a scope appears.

I've configured my .commitlintrc.yml with the following:

  scope:
    level: error
    options:
      - rp_sandbox_a
      - rp_sandbox_b
      - rp_sandbox_c

  # Scope may be empty
  scope-empty:
    level: ignore

… but a commit with no scope fails the scope rule.

KeisukeYamashita commented 2 weeks ago

Thank you for filing this issue! Let me check soon!

KeisukeYamashita commented 2 weeks ago

@scouten-adobe Thank you for your request, I have implemented a new field optional (defaults to false) to scope rule.

 scope:
    level: error
    optional: true
    options:
      - rp_sandbox_a
      - rp_sandbox_b
      - rp_sandbox_c

I hope this will work out in your use case.

KeisukeYamashita commented 2 weeks ago

Released v0.1.12 🚀