use crate::Result;
use std::path::Path;
use super::{build, clippy, format, standards};
pub async fn test_safety_checks(project_path: &Path) -> Result<()> {
println!("๐งช Testing Safety Pipeline Checks");
println!("==================================");
println!("\n๐ Testing Format Check...");
match format::run(project_path).await {
Ok(result) => {
println!(
" {} Format Check ({:.2}s)",
result.status_emoji(),
result.duration.as_secs_f64()
);
if !result.passed {
for error in &result.errors {
println!(" โ ๏ธ {}", error);
}
}
}
Err(e) => println!(" โ Format check error: {}", e),
}
println!("\n๐ Testing Clippy Check...");
match clippy::run(project_path).await {
Ok(result) => {
println!(
" {} Clippy Check ({:.2}s)",
result.status_emoji(),
result.duration.as_secs_f64()
);
if !result.passed {
for error in result.errors.iter().take(3) {
println!(" โ ๏ธ {}", error);
}
}
}
Err(e) => println!(" โ Clippy check error: {}", e),
}
println!("\n๐๏ธ Testing Build Check...");
match build::run(project_path).await {
Ok(result) => {
println!(
" {} Build Check ({:.2}s)",
result.status_emoji(),
result.duration.as_secs_f64()
);
if !result.passed {
for error in result.errors.iter().take(2) {
println!(" โ ๏ธ {}", error);
}
}
}
Err(e) => println!(" โ Build check error: {}", e),
}
println!("\n๐ Testing Standards Check...");
match standards::run(project_path).await {
Ok(result) => {
println!(
" {} Standards Check ({:.2}s)",
result.status_emoji(),
result.duration.as_secs_f64()
);
if !result.passed {
for error in result.errors.iter().take(3) {
println!(" โ ๏ธ {}", error);
}
}
}
Err(e) => println!(" โ Standards check error: {}", e),
}
println!("\n๐ Safety pipeline test complete!");
Ok(())
}