KaiserKarel / substrace

Static analysis for Substrate based projects
27 stars 1 forks source link

Add the enable-singlepass-benchmarks lint to verify that benchmarks are compiled and run during unit tests (single pass). #11

Closed KaiserKarel closed 1 year ago

KaiserKarel commented 1 year ago

In Substrate, benchmarks are not automatically run when running cargo test, meaning that PRs may be mergable if only cargo test is used to verify the codebase. It is quite trivial to configure benchmarks to run during testing (we do it in every Composable pallet), so a lint that ensures that this method is used would be useful.

TheCodingWombat commented 1 year ago

Make sure that besides feature=runtime-benchmarks or test is used in compiler config.

If not possible to find this in AST, use something like ripgrep.