Struct git_checks::checks::CommitSubject
source · pub struct CommitSubject { /* private fields */ }
Expand description
Check commit message subjects for invalid patterns.
Implementations§
source§impl CommitSubject
impl CommitSubject
sourcepub fn new() -> Self
pub fn new() -> Self
Checks commit message subjects for invalid patterns
Patterns which are checked for:
- overly long or short summary lines;
- work-in-progress messages;
fixup!
andsquash!
messages; and- custom prefixes.
Commit messages which appear to have been auto generated by actions such as merging or reverting commits will skip the summary line length limit (if enforced).
sourcepub fn with_summary_limits(&mut self, min: usize, max: usize) -> &mut Self
pub fn with_summary_limits(&mut self, min: usize, max: usize) -> &mut Self
Check the summary line with the given limits.
sourcepub fn check_work_in_progress(&mut self, wip: bool) -> &mut Self
pub fn check_work_in_progress(&mut self, wip: bool) -> &mut Self
Checks for work-in-progress commits
Commit messages which mention WIP
or wip
at the beginning of their commit messages are
rejected since they are (nominally) incomplete.
sourcepub fn check_rebase_commands(&mut self, rebase: bool) -> &mut Self
pub fn check_rebase_commands(&mut self, rebase: bool) -> &mut Self
Check for rebase commands
Rebase commands include commits which begin with fixup!
or squash!
. These subjects
are used to indicate that the commit belongs somewhere else in the branch and should be
completed before merging.
sourcepub fn with_tolerated_prefixes<I, P>(&mut self, patterns: I) -> &mut Selfwhere
I: IntoIterator<Item = P>,
P: Into<Regex>,
pub fn with_tolerated_prefixes<I, P>(&mut self, patterns: I) -> &mut Selfwhere
I: IntoIterator<Item = P>,
P: Into<Regex>,
Check for tolerated commit subject prefixes.
The specified prefix patterns will be tolerated regardless of any configured allowed or disallowed prefixes.
sourcepub fn with_allowed_prefixes<I, P>(&mut self, prefixes: I) -> &mut Selfwhere
I: IntoIterator<Item = P>,
P: Into<String>,
pub fn with_allowed_prefixes<I, P>(&mut self, prefixes: I) -> &mut Selfwhere
I: IntoIterator<Item = P>,
P: Into<String>,
Check for required commit prefixes.
The specified prefixes will be the only allowed prefixes on commit message subjects that do not match a tolerated pattern.
sourcepub fn with_disallowed_prefixes<I, P>(&mut self, prefixes: I) -> &mut Selfwhere
I: IntoIterator<Item = P>,
P: Into<String>,
pub fn with_disallowed_prefixes<I, P>(&mut self, prefixes: I) -> &mut Selfwhere
I: IntoIterator<Item = P>,
P: Into<String>,
Check for disallowed commit prefixes.
The specified prefixes will be rejected on commit message subjects that do not also match a tolerated pattern.
Trait Implementations§
source§impl Check for CommitSubject
impl Check for CommitSubject
source§impl Clone for CommitSubject
impl Clone for CommitSubject
source§fn clone(&self) -> CommitSubject
fn clone(&self) -> CommitSubject
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more