Skip to content

fix(test-detection)route test recognition through one cfg-test set (f…#31

Merged
SaschaOnTour merged 1 commit into
mainfrom
fix/test-recognition
May 30, 2026
Merged

fix(test-detection)route test recognition through one cfg-test set (f…#31
SaschaOnTour merged 1 commit into
mainfrom
fix/test-recognition

Conversation

@SaschaOnTour

Copy link
Copy Markdown
Owner

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)

…ramework attrs + per-crate tests/), fix DEAD_CODE on test entry points, remove unsound --diff mode (v1.3.0)
Copilot AI review requested due to automatic review settings May 30, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_attr to recognize framework test attributes (#[tokio::test], #[rstest], #[test_case], any path ending in test) 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_files set through all structural and DRY collectors so whole test files are skipped uniformly (replacing ad‑hoc contains("/tests/") heuristics); TQ-004/TQ-005 now use the analyzer's is_test flag instead of the test_ 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.

@SaschaOnTour SaschaOnTour merged commit 2f235e1 into main May 30, 2026
2 checks passed
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.

2 participants