pub struct RulesTally {
pub head: Option<String>,
pub working_tree: String,
pub rules: usize,
pub blocking: usize,
pub project: usize,
pub gated: usize,
pub states: BTreeMap<String, usize>,
pub proven: usize,
pub failing: usize,
pub reviewed: usize,
pub unproven: usize,
pub findings: usize,
}Expand description
The rule corpus, counted by crate::rules::report against a commit.
use majordomus_cli::environment::preflight::RulesTally;
use majordomus_cli::evidence::Ledger;
use majordomus_cli::synthetic::SyntheticRepository;
let repo = SyntheticRepository::small().unwrap();
let report = majordomus_cli::rules::report(&repo.index().unwrap(), &Ledger::empty());
let tally = RulesTally::of(&report);
assert_eq!(tally.rules, report.coverage.rules);
assert_eq!(tally.proven, 0, "an empty ledger proves nothing");Fields§
§head: Option<String>The commit it was counted at.
working_tree: Stringclean, dirty or unknown when it was counted.
rules: usizeRules discovered.
blocking: usizeOf those, blocking.
project: usizeOf those, the repository’s own (project.); the rest are vendored.
gated: usizeRules a CI gate runs.
states: BTreeMap<String, usize>Rules in each state, by the state’s printed word.
proven: usizeRules proven against the tree they were counted at.
failing: usizeRules whose latest recorded run failed.
reviewed: usizeRules that declare a reader enforces them.
unproven: usizeRules naming neither a validator nor a test.
findings: usizeRules whose class their proof does not support.
Implementations§
Source§impl RulesTally
impl RulesTally
Sourcepub fn of(report: &RulesReport) -> Self
pub fn of(report: &RulesReport) -> Self
The tally of one report: the counts entry needs, stamped with the commit and tree the report was derived against, so a later reader can tell when it went stale.
use majordomus_cli::environment::preflight::RulesTally;
use majordomus_cli::rules::{RulesReport, RulesVerdict};
let empty = RulesReport { head: None, working_tree: "clean".into(),
verdict: RulesVerdict::Unproven, rules: vec![], states: Default::default(),
coverage: Default::default(), findings: vec![], satisfied: true };
assert_eq!(RulesTally::of(&empty).rules, 0);Trait Implementations§
Source§impl Clone for RulesTally
impl Clone for RulesTally
Source§fn clone(&self) -> RulesTally
fn clone(&self) -> RulesTally
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RulesTally
impl Debug for RulesTally
Source§impl Default for RulesTally
impl Default for RulesTally
Source§fn default() -> RulesTally
fn default() -> RulesTally
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RulesTally
impl<'de> Deserialize<'de> for RulesTally
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RulesTally
Source§impl JsonSchema for RulesTally
impl JsonSchema for RulesTally
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for RulesTally
impl PartialEq for RulesTally
Source§fn eq(&self, other: &RulesTally) -> bool
fn eq(&self, other: &RulesTally) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for RulesTally
impl Serialize for RulesTally
impl StructuralPartialEq for RulesTally
Auto Trait Implementations§
impl Freeze for RulesTally
impl RefUnwindSafe for RulesTally
impl Send for RulesTally
impl Sync for RulesTally
impl Unpin for RulesTally
impl UnsafeUnpin for RulesTally
impl UnwindSafe for RulesTally
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.