detect_patterns

Function detect_patterns 

Source
pub fn detect_patterns(
    path: impl AsRef<Path>,
    pattern_filter: Option<&str>,
    config: Option<PatternConfig>,
) -> Result<PatternAnalysis>
Expand description

Detect design patterns in a file or directory.

§Arguments

  • path - Path to file or directory to analyze
  • pattern_filter - Optional pattern name to filter (e.g., “singleton”, “factory”)
  • config - Optional configuration (uses defaults if None)

§Returns

Analysis result with detected patterns and statistics.

§Example

use go_brrr::patterns::detect_patterns;

// Detect all patterns with default config
let result = detect_patterns("./src", None, None)?;

// Detect only singletons with high confidence
let config = PatternConfig::default().with_min_confidence(0.7);
let singletons = detect_patterns("./src", Some("singleton"), Some(config))?;