pub enum CommitRule {
NotConventional,
SubjectTooLong,
SubjectEmpty,
SubjectTrailingPeriod,
UnknownScope,
FixWithoutTest,
UnresolvedReference,
BreakingUnexplained,
}Expand description
Every code this module can produce, as one closed set.
A judgement is a value here and not a string at the call site. The codes reach a person through a diagnostic, a machine through JSON and a hook through an exit code, and all three read the same list — which is what makes a finding something a rule document can name and a test can assert on.
use majordomus_cli::commit::CommitRule;
// every rule has a stable code, and the order is the order a person would fix them in
assert_eq!(CommitRule::NotConventional.code(), "commit.not_conventional");
assert_eq!(CommitRule::ALL.first(), Some(&CommitRule::NotConventional));
assert!(CommitRule::ALL.iter().all(|r| r.code().starts_with("commit.")));Variants§
NotConventional
The header is not type(scope): subject.
SubjectTooLong
The subject is wider than the policy allows.
SubjectEmpty
The header parsed but said nothing after the colon.
SubjectTrailingPeriod
The subject ends in a full stop; a subject is a title, not a sentence.
UnknownScope
The scope is not one this repository’s history or layout yields.
FixWithoutTest
A fix whose staged files include no test.
UnresolvedReference
The message names a record id the layer does not hold.
BreakingUnexplained
The commit declares itself breaking and explains nothing.
Implementations§
Source§impl CommitRule
impl CommitRule
Sourcepub const ALL: &'static [CommitRule]
pub const ALL: &'static [CommitRule]
Every rule, in the order a verdict reports them. Ordered by how early in the message the evidence for them appears, so a person reads findings in the order they would fix them.
Trait Implementations§
Source§impl Clone for CommitRule
impl Clone for CommitRule
Source§fn clone(&self) -> CommitRule
fn clone(&self) -> CommitRule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CommitRule
Source§impl Debug for CommitRule
impl Debug for CommitRule
Source§impl<'de> Deserialize<'de> for CommitRule
impl<'de> Deserialize<'de> for CommitRule
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>,
impl Eq for CommitRule
Source§impl JsonSchema for CommitRule
impl JsonSchema for CommitRule
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for CommitRule
impl PartialEq for CommitRule
Source§fn eq(&self, other: &CommitRule) -> bool
fn eq(&self, other: &CommitRule) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for CommitRule
impl Serialize for CommitRule
impl StructuralPartialEq for CommitRule
Auto Trait Implementations§
impl Freeze for CommitRule
impl RefUnwindSafe for CommitRule
impl Send for CommitRule
impl Sync for CommitRule
impl Unpin for CommitRule
impl UnsafeUnpin for CommitRule
impl UnwindSafe for CommitRule
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
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
key and return true if they are equal.