slopguard_core/
finding.rs1use std::path::PathBuf;
2
3use serde::{Deserialize, Serialize};
4
5use crate::rule::{Category, RuleId, Severity};
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct Finding {
10 pub rule_id: RuleId,
11 pub severity: Severity,
12 pub category: Category,
13 pub message: String,
14 #[serde(skip_serializing_if = "Option::is_none")]
15 pub note: Option<String>,
16 #[serde(skip_serializing_if = "Option::is_none")]
17 pub fix: Option<String>,
18 pub file: PathBuf,
19 pub line: usize,
20 pub column: usize,
21 pub end_line: usize,
22 pub end_column: usize,
23 pub matched_text: String,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct ScanStats {
29 pub errors: usize,
30 pub warnings: usize,
31 pub total: usize,
32 pub files_scanned: usize,
33}
34
35#[derive(Debug, Clone, Default, Serialize, Deserialize)]
37pub struct CacheStats {
38 pub cached: usize,
39 pub changed: usize,
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
44pub struct ScanResult {
45 pub findings: Vec<Finding>,
46 pub stats: ScanStats,
47 #[serde(default)]
48 pub cache_stats: Option<CacheStats>,
49}