fix(test-detection)route test recognition through one cfg-test set (f…#31
Merged
Conversation
…ramework attrs + per-crate tests/), fix DEAD_CODE on test entry points, remove unsound --diff mode (v1.3.0)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR (v1.3.0) unifies test-code detection across all dimensions through a single authoritative cfg_test_files set and broadens test-attribute recognition. It also fixes a DEAD_CODE false-positive on framework-test entry points under per-crate tests/ directories, and removes the unsound --diff mode that ran whole-program analyses on a partial file set.
Changes:
- Broaden
has_test_attrto recognize framework test attributes (#[tokio::test],#[rstest],#[test_case], any path ending intest) and add per-crate integration-test directory detection by deriving package roots from crate-root files (src/lib.rs/src/main.rs/src/bin/*.rs). - Thread the shared
cfg_test_filesset through all structural and DRY collectors so whole test files are skipped uniformly (replacing ad‑hoccontains("/tests/")heuristics); TQ-004/TQ-005 now use the analyzer'sis_testflag instead of thetest_name prefix. - Remove the
--diff [REF]CLI flag,get_git_changed_files,filter_to_changed, their tests, and all documentation references.
Reviewed changes
Copilot reviewed 47 out of 48 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/lib.rs, src/cli/mod.rs, src/app/tests/run.rs |
Remove the --diff flag, plumbing and CLI tests. |
src/adapters/source/filesystem.rs, src/adapters/source/tests/filesystem.rs |
Drop git-diff helpers and their tests. |
src/adapters/shared/cfg_test.rs, src/adapters/shared/tests/cfg_test.rs, src/adapters/shared/tests/mod.rs |
Broaden has_test_attr to framework test attrs; new unit tests. |
src/adapters/shared/cfg_test_files.rs, src/adapters/shared/tests/cfg_test_files.rs |
Add package-root + is_integration_test_path logic; extensive tests. |
src/adapters/analyzers/structural/{mod,btc,deh,iet,nms,slm}.rs + tests |
Pass cfg_test_files through detectors and collect_metadata; skip whole test files. |
src/adapters/analyzers/dry/{mod,functions,fragments,match_patterns,wildcards}.rs + tests |
DRY collectors consult shared cfg_test_files instead of /tests/ path strings. |
src/adapters/analyzers/dry/tests/dead_code.rs |
Regression test for framework-test entry-point in crate tests/. |
src/adapters/analyzers/tq/coverage.rs + tests |
Use is_test flag rather than test_ name heuristic. |
Cargo.toml, Cargo.lock, CHANGELOG.md |
Bump to 1.3.0 with detailed notes. |
README.md, book/*.md |
Documentation updates removing --diff and clarifying test-file scope. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
fix(test-detection)route test recognition through one cfg-test set (framework attrs + per-crate tests/), fix DEAD_CODE on test entry points, remove unsound --diff mode (v1.3.0)