Skip to main content

CoverageAnalyzer

Struct CoverageAnalyzer 

Source
pub struct CoverageAnalyzer { /* private fields */ }
Expand description

Test coverage analyzer

Implementations§

Source§

impl CoverageAnalyzer

Source

pub fn new() -> Self

Create a new coverage analyzer with default configuration

Source

pub fn with_config(config: CoverageConfig) -> Self

Create a new coverage analyzer with custom configuration

Source

pub fn check_tarpaulin_installed(&self) -> Result<bool>

Check if cargo-tarpaulin is installed

§Errors

Returns an error if the cargo command cannot be executed.

Source

pub async fn install_tarpaulin(&self) -> Result<()>

Install cargo-tarpaulin if not already installed

§Errors

Returns an error if cargo install fails to run or the installation process exits with a non-zero status.

Source

pub async fn run_coverage(&self, project_path: &Path) -> Result<CoverageReport>

Run test coverage analysis

§Errors

Returns an error if cargo-tarpaulin is not installed, the tarpaulin command fails, or the output cannot be parsed.

Source

pub fn config(&self) -> &CoverageConfig

Get config reference

Source

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

§Errors

Returns an error if cargo-tarpaulin is not installed or the coverage run fails.

Source

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

§Errors

Returns an error if the JSON output cannot be parsed.

Source

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.

§Errors

Returns a validation error if report.line_coverage is below threshold.

Source

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

Source

pub fn validate_coverage(&self, report: &CoverageReport) -> Result<()>

Validate coverage meets minimum thresholds

§Errors

Returns a validation error if any coverage metric falls below its configured minimum threshold and fail_on_low_coverage is enabled.

Source

pub fn format_coverage_report(&self, report: &CoverageReport) -> String

Generate a human-readable coverage report

Source

pub async fn check_project_coverage(&self, project_path: &Path) -> Result<()>

Check coverage for a project

§Errors

Returns an error if the coverage run fails or coverage is below the configured minimum thresholds.

Trait Implementations§

Source§

impl Default for CoverageAnalyzer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,