Skip to main content

BaseRate

Struct BaseRate 

Source
pub struct BaseRate {
    pub merges: usize,
    pub reverted: usize,
    pub commits: usize,
    pub revert_commits: usize,
    pub window: usize,
}
Expand description

Base rate over a labelled history.

Fields§

§merges: usize

Merges examined.

§reverted: usize

Merges reverted within the window.

§commits: usize

Commits in the history that was scanned, for context: a rate over 40 merges and a rate over 40,000 are not the same evidence.

§revert_commits: usize

Commits that revert anything, anywhere in the scanned history.

This is the corpus-suitability signal, and measuring git/git is what showed it was needed: 15,579 merges, 46 revert commits in the whole first-parent history, giving a labelled rate of 0.001. That is not “git’s merges are 99.9% safe” — it is a project that drops bad topics from an integration branch before they reach the mainline instead of reverting them. The proxy measures revert culture, and where there is none it reads as safety.

A corpus with near-zero reverts cannot supply a base rate at all. Check this before believing Self::rate.

§window: usize

The window the labelling used, in commits.

Implementations§

Source§

impl BaseRate

Source

pub fn rate(&self) -> f64

Reverted merges as a fraction of merges, in 0.0..=1.0.

A lower bound on the true bad-merge rate, for the reasons in the module docs. A history with no merges scores 0.0 rather than dividing by zero — check Self::merges before believing it.

Source

pub fn corpus_is_suitable(&self) -> bool

Whether the corpus reverts often enough for Self::rate to mean anything, at a deliberately low bar: at least one revert commit per 200 scanned commits.

The threshold is a judgement, not a measurement, and it is set where it is because git/git sits an order of magnitude below it (46 reverts in 24,234 first-parent commits) while a merge-queue-driven project sits above. A false here means “find another corpus”, never “this project’s merges are safe”.

Trait Implementations§

Source§

impl Clone for BaseRate

Source§

fn clone(&self) -> BaseRate

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BaseRate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for BaseRate

Source§

fn eq(&self, other: &BaseRate) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for BaseRate

Source§

impl StructuralPartialEq for BaseRate

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.