#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Dimension {
Iosp,
Complexity,
Dry,
Srp,
Coupling,
TestQuality,
Architecture,
}
impl Dimension {
pub fn from_str_opt(s: &str) -> Option<Self> {
match s.to_lowercase().as_str() {
"iosp" => Some(Self::Iosp),
"complexity" => Some(Self::Complexity),
"dry" => Some(Self::Dry),
"srp" => Some(Self::Srp),
"coupling" => Some(Self::Coupling),
"test_quality" | "tq" | "test" => Some(Self::TestQuality),
"architecture" => Some(Self::Architecture),
_ => None,
}
}
}
impl std::fmt::Display for Dimension {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Iosp => write!(f, "iosp"),
Self::Complexity => write!(f, "complexity"),
Self::Dry => write!(f, "dry"),
Self::Srp => write!(f, "srp"),
Self::Coupling => write!(f, "coupling"),
Self::TestQuality => write!(f, "test_quality"),
Self::Architecture => write!(f, "architecture"),
}
}
}