Skip to main content

tokmd_analysis/grid/
disabled_feature.rs

1//! Disabled-feature warning catalog for analysis presets.
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub enum DisabledFeature {
5    FileInventory,
6    TodoScan,
7    DuplicationScan,
8    NearDuplicateScan,
9    ImportScan,
10    GitMetrics,
11    EntropyProfiling,
12    LicenseRadar,
13    ComplexityAnalysis,
14    ApiSurfaceAnalysis,
15    Archetype,
16    Topics,
17    Fun,
18}
19
20impl DisabledFeature {
21    pub const fn warning(self) -> &'static str {
22        match self {
23            Self::FileInventory => "walk feature disabled; skipping file inventory",
24            Self::TodoScan => "content feature disabled; skipping TODO scan",
25            Self::DuplicationScan => "content feature disabled; skipping duplication scan",
26            Self::NearDuplicateScan => "content feature disabled; skipping near-dup scan",
27            Self::ImportScan => "content feature disabled; skipping import scan",
28            Self::GitMetrics => "git feature disabled; skipping git metrics",
29            Self::EntropyProfiling => "content/walk feature disabled; skipping entropy profiling",
30            Self::LicenseRadar => "content/walk feature disabled; skipping license radar",
31            Self::ComplexityAnalysis => {
32                "content/walk feature disabled; skipping complexity analysis"
33            }
34            Self::ApiSurfaceAnalysis => {
35                "content/walk feature disabled; skipping API surface analysis"
36            }
37            Self::Archetype => {
38                "archetype feature is disabled for analysis; set `archetype` feature to include archetype inference"
39            }
40            Self::Topics => {
41                "topics feature is disabled for analysis; set `topics` feature to include topic clouds"
42            }
43            Self::Fun => {
44                "fun feature is disabled for analysis; set `fun` feature to include eco-label output"
45            }
46        }
47    }
48}
49
50#[cfg(test)]
51mod unit_tests {
52    use super::*;
53
54    #[test]
55    fn disabled_feature_messages_are_declared() {
56        assert!(!DisabledFeature::FileInventory.warning().is_empty());
57        assert!(!DisabledFeature::TodoScan.warning().is_empty());
58        assert!(!DisabledFeature::DuplicationScan.warning().is_empty());
59        assert!(!DisabledFeature::NearDuplicateScan.warning().is_empty());
60        assert!(!DisabledFeature::ImportScan.warning().is_empty());
61        assert!(!DisabledFeature::GitMetrics.warning().is_empty());
62        assert!(!DisabledFeature::EntropyProfiling.warning().is_empty());
63        assert!(!DisabledFeature::LicenseRadar.warning().is_empty());
64        assert!(!DisabledFeature::ComplexityAnalysis.warning().is_empty());
65        assert!(!DisabledFeature::ApiSurfaceAnalysis.warning().is_empty());
66        assert!(!DisabledFeature::Archetype.warning().is_empty());
67        assert!(!DisabledFeature::Topics.warning().is_empty());
68        assert!(!DisabledFeature::Fun.warning().is_empty());
69    }
70}