Skip to content

[GH-9852] Introduce Rubyzen Rule API - #37

Merged
Stelios Frantzeskakis (steliosfran) merged 3 commits into
mainfrom
9852-introduce-rubyzen-rule-api
Nov 4, 2026
Merged

Stelios Frantzeskakis (steliosfran) merged 3 commits into
mainfrom
9852-introduce-rubyzen-rule-api

Conversation

@steliosfran

@steliosfran Stelios Frantzeskakis (steliosfran) commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

Checklist

  • Tests are added or updated for the changes
  • YARD docs are added or updated for the changes
  • bundle exec rake passes locally (runs both the RSpec and Minitest suites)
[GH-9852] Introduce Rubyzen Rule API

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread lib/rubyzen/expectation_helpers.rb Resolved
Copilot AI balanced review requested due to automatic review settings October 29, 2026 22:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Both predicate matchers discard the missing-block diagnostic when rule: is supplied, hiding a malformed assertion behind a misleading production-code fix hint.

1 open issue

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 29, 2026 22:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the changes introducing structured explanations for architectural lint failures.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@steliosfran
Stelios Frantzeskakis (steliosfran) merged commit 50b2339 into main Nov 4, 2026
4 checks passed
@steliosfran
Stelios Frantzeskakis (steliosfran) deleted the 9852-introduce-rubyzen-rule-api branch November 4, 2026 21:08
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.

3 participants