use crate::domain::Finding;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TqFindingKind {
NoAssertion,
NoSut,
Untested,
Uncovered,
UntestedLogic,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct TqKindMeta {
pub ai_category: &'static str,
pub findings_list_category: &'static str,
pub sarif_rule: &'static str,
pub json_kind: &'static str,
pub display_label: &'static str,
}
impl TqFindingKind {
pub const fn meta(self) -> TqKindMeta {
let (ai, fl, sarif, json, display) = match self {
Self::NoAssertion => (
"no_assertion",
"TQ_NO_ASSERT",
"TQ-001",
"no_assertion",
"TQ-001 No assertion",
),
Self::NoSut => (
"no_sut_call",
"TQ_NO_SUT",
"TQ-002",
"no_sut",
"TQ-002 No SUT call",
),
Self::Untested => (
"untested",
"TQ_UNTESTED",
"TQ-003",
"untested",
"TQ-003 Untested",
),
Self::Uncovered => (
"uncovered",
"TQ_UNCOVERED",
"TQ-004",
"uncovered",
"TQ-004 Uncovered",
),
Self::UntestedLogic => (
"untested_logic",
"TQ_UNTESTED_LOGIC",
"TQ-005",
"untested_logic",
"TQ-005 Untested logic",
),
};
TqKindMeta {
ai_category: ai,
findings_list_category: fl,
sarif_rule: sarif,
json_kind: json,
display_label: display,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TqFinding {
pub common: Finding,
pub kind: TqFindingKind,
pub function_name: String,
pub uncovered_lines: Option<Vec<(String, usize)>>,
}