rust-covfix 0.0.2

Fix coverage data generated by kcov
Documentation

rust-covfix

Build Status Build status Version docs GitHub Release Date License: MIT PRs Welcome

Rustc is known to report an incorrect coverage for some lines (https://stackoverflow.com/questions/32521800/why-does-kcov-calculate-incorrect-code-coverage-statistics-for-rust-programs). rust-covfix will read coverage from the file generated by grcov), fix it, then outputs the correct coverage.

Though only lcov format is supprted at current, Another formats is going to be supported in future releases.

Features

  • Compatible with latest stable/beta/nightly Rust compiler
  • Windows/OSX/Linux are all supprted
  • Lightweight (small dependencies)
  • Fast and safe (implemented in Rust language)
  • rust-covfix is also available with Rust API (Documentation)

Optional features

Optional features are available with cargo's --features option. You can specify the features like:

$ cargo install --no-default-features --features "cli lcov"
Feature name Description Default?
cli Command Line Interface. This feature is required to build rust-covfix executable. yes
noinline Avoid adding #cfg[inline] attribute on function. no
lcov Make LcovParser available yes
backtrace Dump backtrace information on every time the error has occured. yes

Install

Download the latest release from GitHub Release Page.

You can also install via cargo command.

$ cargo install rust-covfix

How is the incorrect line coverage detected

rust-covfix will fix the coverage information based on source code and some rules (descrived below).

Rules

1. Line that contain only closing braces or only else statements is not executable

if a > 0 {
    b = a
} else {  // <-- marked as "not executable"
    b = -a
};  // <-- marked as "not executable"

2. Module with name 'tests' are ignored

#[cfg(test)]
mod tests {  // <-- removed from coverage
    fn util() { ... }  // <-- removed from coverage

    #[test]
    fn test_hoge() { ... }  // <-- removed from coverage
}

Roadmap

  • Support cobertura.xml file. (WIP)
  • Add option for uploading the correct coverages to coveralls.
  • Show summary of coverage difference.

Author

👤 Kogia-sima

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2019 Kogia-sima.

This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator