Fix mutation baseline by making heuristics::text doctests compile#73
Draft
leynos wants to merge 1 commit into
Draft
Fix mutation baseline by making heuristics::text doctests compile#73leynos wants to merge 1 commit into
leynos wants to merge 1 commit into
Conversation
The three doctest examples in src/heuristics/text.rs import items via lag_complexity::heuristics::text, but the module was declared pub(crate), so the examples failed to compile under plain `cargo test --all-features`. CI never noticed because `make test` passed --all-targets, which skips doctests entirely, while the scheduled cargo-mutants workflow validates its baseline with plain `cargo test` and therefore failed before exercising any mutants. Promote heuristics::text to a public module: its functions were already `pub` with documentation written against the public path, and publishing them keeps the examples as real, runnable doctests rather than ignored prose. Add `#[must_use]` to weighted_count to satisfy the pedantic must_use_candidate lint on the newly visible function. Also run `cargo test --doc --all-features` from the `test` Makefile target so the gap between --all-targets and plain `cargo test` cannot recur unseen. Closes #66.
Contributor
|
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 |
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.
Closes #66.
Three doctests in
src/heuristics/text.rsimported items vialag_complexity::heuristics::text, but the module was declaredpub(crate), so plaincargo test --all-featuresfailed with E0603 while CI stayed green (make testpassed--all-targets, which skips doctests). The scheduled cargo-mutants workflow validates its unmutated baseline with plaincargo test --all-features, so the baseline failed before any mutants ran.Changes
src/heuristics/mod.rs: promoteheuristics::textfrompub(crate)topub. The module's functions were alreadypub,#[must_use]-annotated, and documented with examples written against the public path, so publishing the module keeps the examples as real, runnable doctests rather than demoting them toignoreprose. The issue lists this as an acceptable resolution, and the crate is pre-1.0.src/heuristics/text.rs: add#[must_use]toweighted_count, satisfying the pedanticmust_use_candidatelint now that the function is externally visible.Makefile: thetesttarget now also runscargo test --doc --all-features, closing the blind spot permanently —--all-targetswill never again mask a doctest that plaincargo test(as run by cargo-mutants) compiles.Validation
cargo test --all-features(doctests included): three consecutive green runs; all 18 doctests pass, including the three previously failing ones (normalize_tokens,weighted_count,substring_count_regex).make test(including the new doctest step),make typecheck,make check-fmt,make markdownlint: green.make lint: Clippy green. The locally installed Whitaker suite reports pre-existingunwrap_or_elsefindings intests/ambiguity_heuristic.rsandtests/lagc_args.rs— files untouched by this diff; CI pinswhitaker-installer0.2.5 and is green onmain, so these are a local toolchain-vintage discrepancy, not introduced here.