Skip to content

feat: implement rule-based field validation#10

Merged
ADernild merged 4 commits into
mainfrom
feat/rules
Jun 8, 2026
Merged

feat: implement rule-based field validation#10
ADernild merged 4 commits into
mainfrom
feat/rules

Conversation

@ADernild

@ADernild ADernild commented Jun 8, 2026

Copy link
Copy Markdown
Owner

feat: implement rule-based field validation

Adds a conditional rule system that enforces constraints on commit fields
after all values are collected.

What's new

Rule engine — Rules consist of a condition and one or more actions.
Conditions support eq, neq, in, exists, and logical combinators (and, or,
not). Actions support require, forbid, and equals, each with an optional
custom message. Violations are collected and reported together with
human-readable messages that include the triggering condition.

Rule validation — Config validation now checks that all fields
referenced in rule conditions and actions exist in the schema, catching
mistakes at load time.

Config refactor — Render logic extracted into render.rs, rules into
rules.rs, and shared tests consolidated into tests.rs. schema.rs is now
focused on data types and structural validation only.

Example

[[rule]]
name = "feat-requires-scope"

[rule.condition]
eq = ["type", "feat"]

[[rule.action]]
require = { fields = ["scope"], message = "Feature commits must have a scope" }

ADernild added 4 commits June 6, 2026 11:57
- Moving render logic to separate module.
- Splitting schema validation logic into multiple methods.
Add a conditional rule system that enforces constraints on commit fields
after all values are collected. Rules consist of a condition (Eq, Neq,
In, Exists, and logical combinators) and one or more actions (Require,
Forbid, Equals). Violations are reported together before committing.
@ADernild ADernild merged commit 4b3ceaa into main Jun 8, 2026
5 checks passed
@ADernild ADernild deleted the feat/rules branch June 8, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant