Skip to main content

sniff/
report_types.rs

1use serde::{Deserialize, Serialize};
2
3use crate::types::FindingTier;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct StaticFlag {
7    #[serde(rename = "type")]
8    pub flag_type: String,
9    pub file_path: String,
10    pub method_name: Option<String>,
11    pub reasons: Vec<String>,
12    pub tier: FindingTier,
13    pub gate: String,
14    pub loc: usize,
15    pub start_line: usize,
16    pub end_line: usize,
17}
18
19#[derive(Debug, Clone, Serialize, Deserialize)]
20pub struct FileVerdict {
21    pub file_path: String,
22    pub role: String,
23    pub verdict: FindingTier,
24    pub top_reasons: Vec<String>,
25    pub flagged_methods: Vec<String>,
26    pub recommended_action: String,
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
30pub struct LLMVerdict {
31    #[serde(rename = "type")]
32    pub verdict_type: String,
33    pub file_path: String,
34    pub method_name: Option<String>,
35    pub check_type: String,
36    pub smelly: bool,
37    pub tier: FindingTier,
38    pub cohesive: Option<bool>,
39    pub name_accurate: Option<bool>,
40    pub evidence: String,
41    pub reason: String,
42    pub loc: usize,
43    pub start_line: usize,
44    pub end_line: usize,
45}
46
47#[derive(Debug, Clone, Default, Serialize, Deserialize)]
48pub struct RunStats {
49    pub files_scanned: usize,
50    pub methods_analyzed: usize,
51    pub flagged_by_ref_count: usize,
52    pub flagged_by_scorer: usize,
53    pub duplication_static: usize,
54    pub churn_static: usize,
55    pub architecture_static: usize,
56    pub test_coupling_static: usize,
57    pub provenance_static: usize,
58    pub slop_static: usize,
59    pub kinda_slop_static: usize,
60    pub slop_ai: usize,
61    pub kinda_slop_ai: usize,
62    pub ai_reviews: usize,
63    pub ai_expected_reviews: usize,
64    pub ai_failed_reviews: usize,
65    pub dead_methods: usize,
66    pub inline_candidates: usize,
67    pub input_tokens: usize,
68    pub output_tokens: usize,
69    pub estimated_cost_usd: f64,
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
73pub struct RunReport {
74    pub file_verdicts: Vec<FileVerdict>,
75    pub static_flags: Vec<StaticFlag>,
76    pub llm_verdicts: Vec<LLMVerdict>,
77    pub stats: RunStats,
78}