pmat 3.26.0

PMAT - Zero-config AI context generation and code quality toolkit (CLI, MCP, HTTP)
#![cfg_attr(coverage_nightly, coverage(off))]
//! Stub module for backward compatibility during AST migration
//!
//! This module provides minimal stubs to prevent compilation errors.
//! All functionality has been moved to server/src/ast/

use anyhow::Result;
use std::path::Path;

// Stub types for backward compatibility
/// Analyzer pool.
pub struct AnalyzerPool;

impl Default for AnalyzerPool {
    fn default() -> Self {
        Self::new()
    }
}

impl AnalyzerPool {
    #[must_use]
    #[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
    /// Create a new instance.
    pub fn new() -> Self {
        Self
    }
}

/// Rust analyzer.
pub struct RustAnalyzer;

impl Default for RustAnalyzer {
    fn default() -> Self {
        Self::new()
    }
}

impl RustAnalyzer {
    #[must_use]
    #[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
    /// Create a new instance.
    pub fn new() -> Self {
        Self
    }

    #[provable_contracts_macros::contract("pmat-core.yaml", equation = "path_exists")]
    /// Analyze file.
    pub fn analyze_file(&self, _path: &Path) -> Result<()> {
        Ok(())
    }
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(test)]
mod tests {
    use super::*;

    // ============ AnalyzerPool Tests ============

    #[test]
    fn test_analyzer_pool_new() {
        let _pool = AnalyzerPool::new();
    }

    #[test]
    fn test_analyzer_pool_default() {
        let _pool = AnalyzerPool;
    }

    // ============ RustAnalyzer Tests ============

    #[test]
    fn test_rust_analyzer_new() {
        let _analyzer = RustAnalyzer::new();
    }

    #[test]
    fn test_rust_analyzer_default() {
        let _analyzer = RustAnalyzer;
    }

    #[test]
    fn test_rust_analyzer_analyze_file() {
        let analyzer = RustAnalyzer::new();
        let result = analyzer.analyze_file(Path::new("/tmp/nonexistent.rs"));
        assert!(result.is_ok());
    }

    #[test]
    fn test_rust_analyzer_analyze_file_empty_path() {
        let analyzer = RustAnalyzer::new();
        let result = analyzer.analyze_file(Path::new(""));
        assert!(result.is_ok());
    }

    #[test]
    fn test_rust_analyzer_analyze_file_relative_path() {
        let analyzer = RustAnalyzer::new();
        let result = analyzer.analyze_file(Path::new("src/main.rs"));
        assert!(result.is_ok());
    }

    #[test]
    fn test_rust_analyzer_analyze_file_absolute_path() {
        let analyzer = RustAnalyzer::new();
        let result = analyzer.analyze_file(Path::new("/home/user/project/lib.rs"));
        assert!(result.is_ok());
    }

    #[test]
    fn test_rust_analyzer_analyze_file_with_extension() {
        let analyzer = RustAnalyzer::new();
        let result = analyzer.analyze_file(Path::new("test.rs"));
        assert!(result.is_ok());
    }

    #[test]
    fn test_rust_analyzer_analyze_file_without_extension() {
        let analyzer = RustAnalyzer::new();
        let result = analyzer.analyze_file(Path::new("Makefile"));
        assert!(result.is_ok());
    }
}