Skip to main content

dk_runner/
findings.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub enum Severity {
5    Error,
6    Warning,
7    Info,
8}
9
10impl Severity {
11    pub fn as_str(&self) -> &'static str {
12        match self {
13            Self::Error => "error",
14            Self::Warning => "warning",
15            Self::Info => "info",
16        }
17    }
18
19    pub fn icon(&self) -> &'static str {
20        match self {
21            Self::Error => "[ERR]",
22            Self::Warning => "[WARN]",
23            Self::Info => "[INFO]",
24        }
25    }
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct Finding {
30    pub severity: Severity,
31    pub check_name: String,
32    pub message: String,
33    pub file_path: Option<String>,
34    pub line: Option<u32>,
35    pub symbol: Option<String>,
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
39pub struct Suggestion {
40    pub finding_index: usize,
41    pub description: String,
42    pub file_path: String,
43    pub replacement: Option<String>,
44}