| Crates.io | coverage_lint |
| lib.rs | coverage_lint |
| version | 0.1.2 |
| created_at | 2025-12-03 06:11:01.439168+00 |
| updated_at | 2025-12-03 06:39:24.427186+00 |
| description | A no-config Rust test coverage linter. |
| homepage | |
| repository | https://github.com/ericfindlay/coverage_lint |
| max_upload_size | |
| id | 1963434 |
| size | 45,996 |
cargo install coverage_lint
coverage # run in any Rust project
A zero-config Rust test-coverage linter.
What it does
.rs file in the tree.What it does not do
To associate a function with a test add an annotation,
// test: foo_test
pub fn foo() {}
or if you want to associate multiple tests with a function add an annotation group,
// test: foo_test1
// test: foo_test2
pub fn foo() {}
or if you want coverage to ignore a function,
// test:
pub fn foo() {}
Warnings are raised whenever:
When we run this tool we get output similar to
...
21 src/lib.rs: [fa] 611 verify_group_annotations_all_have_tests() has no annotations.
22 src/lib.rs: [fa] 642 verify_annotation_has_test() has no annotations.
23 src/lib.rs: [mw] 662 Test name on line 660 must be one word not 'TODO: test_invalid'.
24 src/lib.rs: [fa] 684 verify_tests_have_associated_fns() has no annotations.
25 src/lib.rs: [fa] 721 fmt() has no annotations.
26 src/lib.rs: [fa] 776 new() has no annotations.
27 src/lib.rs: [fa] 785 split_functions() has no annotations.
28 src/lib.rs: [fa] 806 visit_item_fn() has no annotations.
29 src/lib.rs: [fa] 810 visit_item_mod() has no annotations.
30 src/lib.rs: [fa] 818 visit_impl_item_fn() has no annotations.
31 src/lib.rs: [fa] 835 visit_item_macro() has no annotations.
32 src/lib.rs: [fa] 913 visit() has no annotations.
33 src/lib.rs: [tf] 1249 Test empty_test_annotation_should_not_remove_function() has no associated function.
34 src/lib.rs: [tf] 1138 Test missing_test_annotation_should_set_verification_info() has no associated function.
...
Because the output is line oriented results can be easily filtered with a grep-like tool. Every category of warning can be distinguished by one of the following:
[ft] Function without a test.
[tf] Test without a function.
[fa] Function without an annotation.
[it] Invalid test name.
[mt] Multiple test names.
[mw] Multi-word test name.
[ig] Invalid annotation group.