Reduce builder core assertion blocks (#40)#198
Conversation
Refactor builder core tests to replace dense assertion runs with tracked semantic helpers and `rstest` parameterised cases. Keep the change test-only so builder behaviour remains unchanged while making future failures easier to read.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Reviewer's GuideRefactors builder core tests to use shared assertion helpers and rstest parameterization, reducing duplicated assertion blocks while preserving test coverage and semantics. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Code Health Improved
(1 files improve in Code Health)
Gates Failed
Enforce advisory code health rules
(1 file with Excess Number of Function Arguments)
Gates Passed
5 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| tests.rs | 1 advisory rule | 8.82 → 9.10 | Suppress |
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| tests.rs | 8.82 → 9.10 | Large Assertion Blocks |
Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
| pub(super) fn assert_build_result_failure( | ||
| res: &BuildResult, | ||
| expected_error: &str, | ||
| expected_warnings: usize, | ||
| tests_passed: u32, | ||
| tests_failed: u32, | ||
| ) { | ||
| assert_build_failure_contains(res, expected_error); | ||
| assert_eq!( | ||
| ( | ||
| res.validation_warnings.len(), | ||
| res.tests_passed, | ||
| res.tests_failed, | ||
| res.registered, | ||
| ), | ||
| (expected_warnings, tests_passed, tests_failed, false) | ||
| ); | ||
| } |
There was a problem hiding this comment.
❌ New issue: Excess Number of Function Arguments
assertions.assert_build_result_failure has 5 arguments, max arguments = 4
Summary
This branch reduces the large assertion blocks in the builder core tests by moving repeated checks into semantic helper assertions and by parameterizing language command cases with
rstest. The change is test-only and preserves the existing builder behaviour while making failures easier to interpret.Closes #40.
Review walkthrough
assertionshelpers and the#[track_caller]annotations.rstestcases in src/tools/builder/core/tests.rs for language extension, build command and test command coverage.Validation
cargo test tools::builder::core::tests: passed, 29 builder core tests.make all: passed, including format checks, clippy configurations, default nextest with 4,122 passed tests, and 5 GitHub tool tests.src/tools/builder/core/tests.rsexceeded three consecutive assertion macro lines.coderabbit review --agent: attempted three times, but CodeRabbit returned usage-credit rate-limit errors before producing a review.Notes
This branch does not change production code or feature parity status.
Summary by Sourcery
Refine builder core tests by extracting shared assertion helpers and parameterizing language command coverage without changing production behavior.
Enhancements:
Tests: