Skip to main content

mit_commit_message_lints/
scope.rs

1//! A module representing the scope
2
3/// The scopes we might read the config for
4#[derive(Ord, PartialOrd, Eq, PartialEq, Debug, Clone, clap::ValueEnum, Copy)]
5pub enum Scope {
6    /// The home directory
7    Global,
8    /// The local folder
9    Local,
10}
11impl Scope {
12    /// If this scope is global or not
13    #[must_use]
14    pub fn is_global(&self) -> bool {
15        &Self::Global == self
16    }
17}
18
19#[cfg(test)]
20mod tests {
21    use super::Scope;
22
23    #[test]
24    fn global_scope_is_global() {
25        assert!(
26            Scope::Global.is_global(),
27            "Expected the Global scope to report as global"
28        );
29    }
30
31    #[test]
32    fn local_scope_is_not_global() {
33        assert!(
34            !Scope::Local.is_global(),
35            "Expected the Local scope to not report as global"
36        );
37    }
38}