pub struct CommitPolicy {
pub subject_max_chars: usize,
pub scope_unknown: FindingLevel,
pub fix_requires_test: FindingLevel,
pub reference_unresolved: FindingLevel,
pub breaking_unexplained: FindingLevel,
}Expand description
commit: in the repository policy: the subject width, and how loudly to report the four
judgements a repository can reasonably decide differently about. The type vocabulary is
deliberately absent — it is crate::release::ChangeKind, which the changelog already
renders from, and a second copy of those words here is the duplication this subsystem
exists to remove.
use majordomus_cli::commit::{CommitPolicy, FindingLevel};
// a policy that says nothing is the default this repository's history already satisfies
let quiet: CommitPolicy = serde_json::from_str("{}").expect("an empty block");
assert_eq!(quiet, CommitPolicy::default());
assert_eq!(quiet.subject_max_chars, 72);
// and one that says something keeps the defaults it did not mention
let narrow: CommitPolicy =
serde_json::from_str(r#"{"subject_max_chars": 50}"#).expect("a block");
assert_eq!(narrow.subject_max_chars, 50);
assert_eq!(narrow.reference_unresolved, FindingLevel::Error);Fields§
§subject_max_chars: usizeThe widest a subject line may be. 72 is what a terminal and every git viewer show without wrapping, and what this repository’s history already keeps to.
scope_unknown: FindingLevelA scope outside the vocabulary the repository’s own history and layout yield. A warning by default: the vocabulary is inferred, and inference must not refuse the first commit of a new subsystem.
fix_requires_test: FindingLevelA fix whose staged files include no test. The strongest available evidence that a
bug fix carries a regression test, and the cheapest place to ask for it.
reference_unresolved: FindingLevelA record id in the message — I1305, M000 — that the layer does not hold. An
error by default: a reference to a record that does not exist cannot be told from a
good one until somebody follows it, which is usually months later.
breaking_unexplained: FindingLevelA commit that declares itself breaking and says nothing else. An error by default:
the ! is the only mark a release reads, and a release note derived from a breaking
change with no explanation is a release note that says a thing broke.
Trait Implementations§
Source§impl Clone for CommitPolicy
impl Clone for CommitPolicy
Source§fn clone(&self) -> CommitPolicy
fn clone(&self) -> CommitPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommitPolicy
impl Debug for CommitPolicy
Source§impl Default for CommitPolicy
impl Default for CommitPolicy
Source§impl<'de> Deserialize<'de> for CommitPolicy
impl<'de> Deserialize<'de> for CommitPolicy
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 CommitPolicy
Source§impl JsonSchema for CommitPolicy
impl JsonSchema for CommitPolicy
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 CommitPolicy
impl PartialEq for CommitPolicy
Source§fn eq(&self, other: &CommitPolicy) -> bool
fn eq(&self, other: &CommitPolicy) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for CommitPolicy
impl Serialize for CommitPolicy
impl StructuralPartialEq for CommitPolicy
Auto Trait Implementations§
impl Freeze for CommitPolicy
impl RefUnwindSafe for CommitPolicy
impl Send for CommitPolicy
impl Sync for CommitPolicy
impl Unpin for CommitPolicy
impl UnsafeUnpin for CommitPolicy
impl UnwindSafe for CommitPolicy
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.