Skip to content

Detailed code coverage reporting #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 29, 2025
Merged

Detailed code coverage reporting #279

merged 15 commits into from
Jul 29, 2025

Conversation

DariuszDepta
Copy link
Member

@DariuszDepta DariuszDepta commented Jul 28, 2025

For some time now, the Rust code coverage tool cargo-llvm-cov has been generating high-quality and detailed code coverage statistics. To better reflect this in daily maintenance tasks, a new badge has been added to report more accurate coverage for this crate. The codecov badge was removed due to its lower precision.

A new task named cov-badge was added to Taskfile.yml to automatically generate the more accurate coverage badge for this crate.

The new badge displays three numbers, like: 94% │ 93% │ 95%
These numbers are the truncated coverage percentages for covered regions, executed functions and covered lines respectively. Exactly in the same order like the textual coverage report does when called like this (for MultiTest) in the TOTAL summary line:

$ cargo +stable llvm-cov --no-cfg-coverage --all-features

The example output is like shown below:

Filename                                       Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
addresses.rs                                        74                 1    98.65%           9                 0   100.00%          54                 0   100.00%           0                 0         -
api.rs                                             126                 0   100.00%          17                 0   100.00%         116                 0   100.00%           0                 0         -
app.rs                                             473                60    87.32%          50                 3    94.00%         361                38    89.47%           0                 0         -
app_builder.rs                                     278                 0   100.00%          15                 0   100.00%         376                 0   100.00%           0                 0         -
bank.rs                                            854                54    93.68%          26                 2    92.31%         422                23    94.55%           0                 0         -
checksums.rs                                         5                 0   100.00%           1                 0   100.00%           3                 0   100.00%           0                 0         -
contracts.rs                                       279                42    84.95%          39                 6    84.62%         315                41    86.98%           0                 0         -
custom_handler.rs                                   36                 6    83.33%           9                 2    77.78%          52                 6    88.46%           0                 0         -
error.rs                                            48                 0   100.00%          10                 0   100.00%          34                 0   100.00%           0                 0         -
executor.rs                                        131                18    86.26%          12                 1    91.67%         122                13    89.34%           0                 0         -
module.rs                                           33                 0   100.00%          10                 0   100.00%          74                 0   100.00%           0                 0         -
prefixed_storage.rs                                304                 6    98.03%          23                 1    95.65%         146                 3    97.95%           0                 0         -
prefixed_storage/length_prefixed.rs                258                 0   100.00%          12                 0   100.00%         111                 0   100.00%           0                 0         -
prefixed_storage/namespace_helpers.rs              330                 0   100.00%          13                 0   100.00%         134                 0   100.00%           0                 0         -
prefixed_storage/typed_prefixed_storage.rs          74                11    85.14%          15                 3    80.00%          79                12    84.81%           0                 0         -
staking.rs                                        2411               124    94.86%          84                 3    96.43%        1836                42    97.71%           0                 0         -
stargate.rs                                         29                 0   100.00%           8                 0   100.00%         101                 0   100.00%           0                 0         -
test_helpers/caller.rs                              21                 3    85.71%           4                 1    75.00%          28                 5    82.14%           0                 0         -
test_helpers/echo.rs                                81                16    80.25%           7                 3    57.14%          63                 7    88.89%           0                 0         -
test_helpers/error.rs                               25                 3    88.00%           5                 1    80.00%          35                 3    91.43%           0                 0         -
test_helpers/gov.rs                                 25                 3    88.00%           4                 1    75.00%          19                 3    84.21%           0                 0         -
test_helpers/hackatom.rs                            71                15    78.87%           7                 1    85.71%          49                 8    83.67%           0                 0         -
test_helpers/ibc.rs                                 25                 3    88.00%           4                 1    75.00%          18                 3    83.33%           0                 0         -
test_helpers/payout.rs                              64                 6    90.62%           5                 0   100.00%          39                 0   100.00%           0                 0         -
test_helpers/reflect.rs                             58                 4    93.10%           6                 0   100.00%          45                 0   100.00%           0                 0         -
test_helpers/stargate.rs                            21                 3    85.71%           4                 1    75.00%          17                 3    82.35%           0                 0         -
transactions.rs                                    784                 0   100.00%          33                 0   100.00%         304                 0   100.00%           0                 0         -
wasm.rs                                           2353               115    95.11%          87                 3    96.55%        1528                56    96.34%           0                 0         -
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                             9271               493    94.68%         519                33    93.64%        6481               266    95.90%           0                 0         -

@DariuszDepta DariuszDepta added this to the 3.0.2 milestone Jul 28, 2025
@DariuszDepta DariuszDepta self-assigned this Jul 28, 2025
@DariuszDepta DariuszDepta added the maintenance Maintenance label Jul 28, 2025
@DariuszDepta DariuszDepta requested a review from pinosu July 29, 2025 10:42
Copy link

@pinosu pinosu left a comment

Choose a reason for hiding this comment

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

Nice work! Lgtm

@DariuszDepta DariuszDepta merged commit 3bf8459 into main Jul 29, 2025
@DariuszDepta DariuszDepta deleted the detailed-coverage branch July 29, 2025 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants