pub mod json;
pub mod terminal;
use crate::config::Config;
use crate::config::thresholds::Severity;
use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf};
pub fn print_reports(reports: &[FileReport], quiet: bool, json_path: Option<&Path>) {
if let Some(path) = json_path {
json::write_json_report(reports, path);
}
terminal::print_summary(reports, quiet);
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Issue {
pub message: String,
pub severity: Severity,
pub line: Option<usize>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct FileReport {
pub path: PathBuf,
pub lines: usize,
pub imports: usize,
pub max_depth: usize,
pub repetition: f64,
pub is_sweet: bool,
pub issues: Vec<Issue>,
#[serde(skip_serializing)]
pub config: Option<Config>,
pub duplicates: Vec<RepetitionDetail>,
pub deep_lines: Vec<(usize, usize)>,
#[serde(skip)]
pub hashes: Vec<(usize, u64)>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct RepetitionDetail {
pub content: String,
pub line: usize,
pub occurrences: Vec<(PathBuf, usize)>,
}