Repository navigation
[GH-9852] Introduce Rubyzen Rule API - #37
Merged
Stelios Frantzeskakis (steliosfran) merged 3 commits intoNov 4, 2026
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Rule-based failure messages hide missing-block errors and negated matcher failure reasons, potentially misleading users; preserve the base message when classified details are absent and add specs for both cases.
1 open issue
What changed in this PR
Introduces Rubyzen::Rule to give architectural lint failures structured descriptions, rationale, fix hints, and code examples across RSpec and Minitest.
Changes:
- Adds keyword and block-based rule construction with formatted failure messages.
- Integrates
rule:into all three matchers and assertions while preserving custom-message precedence. - Adds tests, sample usage, and documentation, and bumps the gem version to
0.4.0.
| File | Description |
|---|---|
test/assertions/assert_zen_true_test.rb |
Tests rule messages, baselines, and message precedence. |
test/assertions/assert_zen_false_test.rb |
Tests rule messages, baselines, and message precedence. |
test/assertions/assert_zen_empty_test.rb |
Tests rule formatting, validation, and state isolation. |
spec/rule_spec.rb |
Tests construction, normalization, and rendering. |
spec/matchers/zen_true_matcher_spec.rb |
Tests rule integration for zen_true. |
spec/matchers/zen_false_matcher_spec.rb |
Tests rule integration for zen_false. |
spec/matchers/zen_empty_matcher_spec.rb |
Tests rule integration and validation for zen_empty. |
sample_project/test/controllers/no_if_statements_in_controllers_test.rb |
Adds a shared rule to Minitest examples. |
sample_project/spec/controllers/no_if_statements_in_controllers_lint_spec.rb |
Adds a shared rule to RSpec examples. |
README.md |
Demonstrates structured rule explanations. |
lib/rubyzen/version.rb |
Bumps the version to 0.4.0. |
lib/rubyzen/rule.rb |
Implements rule construction and rendering. |
lib/rubyzen/matchers/zen_true_matcher.rb |
Accepts and forwards rule explanations. |
lib/rubyzen/matchers/zen_false_matcher.rb |
Accepts and forwards rule explanations. |
lib/rubyzen/matchers/zen_empty_matcher.rb |
Accepts and forwards rule explanations. |
lib/rubyzen/expectation_helpers.rb |
Centralizes explanation validation and formatting. |
lib/rubyzen/assertions/assert_zen_true.rb |
Adds the rule: option. |
lib/rubyzen/assertions/assert_zen_false.rb |
Adds the rule: option. |
lib/rubyzen/assertions/assert_zen_empty.rb |
Adds the rule: option. |
CLAUDE.md |
Documents rule architecture and usage. |
CHANGELOG.md |
Records the 0.4.0 additions. |
.claude/skills/write-lint-rule/SKILL.md |
Adds guidance for explanatory rules. |
.claude/skills/add-rubyzen-tests/SKILL.md |
Documents rule-related test coverage. |
Review effort: Balanced
Bastian (bkoell)
approved these changes
Nov 2, 2026
Stelios Frantzeskakis (steliosfran)
deleted the
9852-introduce-rubyzen-rule-api
branch
November 4, 2026 21:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What changed and why
Checklist
bundle exec rakepasses locally (runs both the RSpec and Minitest suites)[GH-9852] Introduce Rubyzen Rule API