#![cfg_attr(coverage_nightly, coverage(off))]
use crate::cli::commands::{ConfigFormat, QualityGatesCommand};
use crate::quality::gates::{execute_all_gates, format_report, GateConfig, QualityReport};
use crate::quality::{generate_config_toml, generate_default_config, validate_config};
use anyhow::Result;
use std::path::{Path, PathBuf};
#[derive(Debug, Default, serde::Deserialize)]
#[serde(default)]
struct GateConfigToml {
gates: GateConfigInner,
}
#[derive(Debug, serde::Deserialize)]
#[serde(default)]
struct GateConfigInner {
run_clippy: bool,
clippy_strict: bool,
run_tests: bool,
test_timeout: u64,
check_coverage: bool,
min_coverage: f64,
check_complexity: bool,
max_complexity: u32,
}
impl Default for GateConfigInner {
fn default() -> Self {
Self {
run_clippy: true,
clippy_strict: true,
run_tests: true,
test_timeout: 300,
check_coverage: true,
min_coverage: 80.0,
check_complexity: true,
max_complexity: 10,
}
}
}
impl From<GateConfigToml> for GateConfig {
fn from(toml: GateConfigToml) -> Self {
let g = toml.gates;
GateConfig {
run_clippy: g.run_clippy,
clippy_strict: g.clippy_strict,
run_tests: g.run_tests,
test_timeout: g.test_timeout,
check_coverage: g.check_coverage,
min_coverage: g.min_coverage,
check_complexity: g.check_complexity,
max_complexity: g.max_complexity,
}
}
}
include!("quality_gates_handler_execution.rs");
include!("quality_gates_handler_output.rs");
include!("quality_gates_handler_tests.rs");