pub struct CoverageAnalyzer { /* private fields */ }Expand description
Test coverage analyzer
Implementations§
Source§impl CoverageAnalyzer
impl CoverageAnalyzer
Sourcepub fn with_config(config: CoverageConfig) -> Self
pub fn with_config(config: CoverageConfig) -> Self
Create a new coverage analyzer with custom configuration
Sourcepub fn check_tarpaulin_installed(&self) -> Result<bool>
pub fn check_tarpaulin_installed(&self) -> Result<bool>
Check if cargo-tarpaulin is installed
Sourcepub async fn install_tarpaulin(&self) -> Result<()>
pub async fn install_tarpaulin(&self) -> Result<()>
Install cargo-tarpaulin if not already installed
Sourcepub async fn run_coverage(&self, project_path: &Path) -> Result<CoverageReport>
pub async fn run_coverage(&self, project_path: &Path) -> Result<CoverageReport>
Run test coverage analysis
Sourcepub fn config(&self) -> &CoverageConfig
pub fn config(&self) -> &CoverageConfig
Get config reference
Sourcepub async fn run_tarpaulin(&self, project_path: &Path) -> Result<CoverageReport>
pub async fn run_tarpaulin(&self, project_path: &Path) -> Result<CoverageReport>
Run tarpaulin and get coverage report
This is a convenience wrapper around run_coverage that’s more explicit about running tarpaulin
Sourcepub fn parse_coverage_report(
&self,
tarpaulin_output: &str,
) -> Result<CoverageReport>
pub fn parse_coverage_report( &self, tarpaulin_output: &str, ) -> Result<CoverageReport>
Parse a coverage report from tarpaulin output
Parses the JSON output from cargo-tarpaulin and converts it to our CoverageReport format
Sourcepub fn enforce_minimum_coverage(
&self,
report: &CoverageReport,
threshold: f64,
) -> Result<()>
pub fn enforce_minimum_coverage( &self, report: &CoverageReport, threshold: f64, ) -> Result<()>
Enforce minimum coverage threshold
Returns an error if the coverage is below the specified threshold
Sourcepub fn generate_coverage_badge(&self, report: &CoverageReport) -> String
pub fn generate_coverage_badge(&self, report: &CoverageReport) -> String
Generate a coverage badge SVG
Creates an SVG badge showing the current test coverage percentage
Source§impl CoverageAnalyzer
impl CoverageAnalyzer
Sourcepub fn validate_coverage(&self, report: &CoverageReport) -> Result<()>
pub fn validate_coverage(&self, report: &CoverageReport) -> Result<()>
Validate coverage meets minimum thresholds
Sourcepub fn format_coverage_report(&self, report: &CoverageReport) -> String
pub fn format_coverage_report(&self, report: &CoverageReport) -> String
Generate a human-readable coverage report
Sourcepub async fn check_project_coverage(&self, project_path: &Path) -> Result<()>
pub async fn check_project_coverage(&self, project_path: &Path) -> Result<()>
Check coverage for a project
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CoverageAnalyzer
impl RefUnwindSafe for CoverageAnalyzer
impl Send for CoverageAnalyzer
impl Sync for CoverageAnalyzer
impl Unpin for CoverageAnalyzer
impl UnsafeUnpin for CoverageAnalyzer
impl UnwindSafe for CoverageAnalyzer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more