soma-core 2.0.2

World's first production-ready self-aware development system with meta-cognitive capabilities and cognitive reasoning engine for intelligent development platforms
Documentation
// examples/test_code.rs
// Sample code file for agent editing demonstrations

use std::collections::HashMap;

pub struct DataProcessor {
    data: Vec<String>,
    _cache: HashMap<String, String>,
}

impl DataProcessor {
    pub fn new() -> Self {
        Self {
            data: Vec::new(),
            _cache: HashMap::new(),
        }
    }

    // This function has performance issues (agents should detect this)
    pub fn process_items(&self, items: Vec<String>) -> Vec<String> {
        let mut results = Vec::new();
        for item in items {
            // Inefficient: creates unnecessary clones
            let processed = item.clone() + "_processed";
            results.push(processed);
        }
        results
    }

    // This function lacks proper error handling
    pub fn get_data(&self, index: usize) -> String {
        self.data[index].clone() // Could panic!
    }

    // This function needs better documentation
    pub fn calc(a: i32, b: i32) -> i32 {
        a + b
    }
}

// Missing tests (agents should suggest adding them)

fn main() {
    let processor = DataProcessor::new();
    let items = vec!["item1".to_string(), "item2".to_string()];
    let results = processor.process_items(items);
    println!("Results: {:?}", results);
}