use super::simple_service::SimpleContractService;
use super::{
AnalyzeComplexityContract, AnalyzeDeadCodeContract, AnalyzeEntropyContract,
AnalyzeLintHotspotContract, AnalyzeSatdContract, AnalyzeTdgContract, QualityGateContract,
RefactorAutoContract,
};
use anyhow::Result;
use serde_json::Value;
use std::sync::Arc;
pub struct ContractService {
inner: Arc<SimpleContractService>,
}
impl ContractService {
pub fn new() -> Result<Self> {
Ok(Self {
inner: Arc::new(SimpleContractService::new()?),
})
}
pub async fn analyze_complexity(&self, contract: AnalyzeComplexityContract) -> Result<Value> {
self.inner.analyze_complexity(contract).await
}
pub async fn analyze_satd(&self, contract: AnalyzeSatdContract) -> Result<Value> {
self.inner.analyze_satd(contract).await
}
pub async fn analyze_dead_code(&self, contract: AnalyzeDeadCodeContract) -> Result<Value> {
self.inner.analyze_dead_code(contract).await
}
pub async fn analyze_tdg(&self, contract: AnalyzeTdgContract) -> Result<Value> {
self.inner.analyze_tdg(contract).await
}
pub async fn analyze_lint_hotspot(
&self,
contract: AnalyzeLintHotspotContract,
) -> Result<Value> {
self.inner.analyze_lint_hotspot(contract).await
}
pub async fn analyze_entropy(&self, contract: AnalyzeEntropyContract) -> Result<Value> {
self.inner.analyze_entropy(contract).await
}
pub async fn quality_gate(&self, contract: QualityGateContract) -> Result<Value> {
self.inner.quality_gate(contract).await
}
pub async fn refactor_auto(&self, contract: RefactorAutoContract) -> Result<Value> {
self.inner.refactor_auto(contract).await
}
}
pub use self::ContractService as UnifiedService;
include!("service_property_tests.rs");
include!("service_coverage_tests.rs");
include!("service_quality_tests.rs");