Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/engine/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,32 @@ impl fmt::Display for IssueType {
}
}

impl IssueType {
/// Parse from string with lenient matching (accepts plural forms, etc.)
pub fn from_str_lossy(s: &str) -> Self {
match s.to_lowercase().as_str() {
"security" | "sec" => IssueType::Security,
"performance" | "perf" => IssueType::Performance,
"bug" | "bugs" => IssueType::Bug,
"best_practice" | "best-practice" | "bestpractice" | "best practice" => IssueType::BestPractice,
"style" | "formatting" => IssueType::Style,
"suggestion" | "info" => IssueType::Suggestion,
_ => IssueType::Suggestion, // fallback
}
}
}

/// A single review issue found in code
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ReviewIssue {
pub file: String,
#[serde(default)]
pub line: Option<u32>,
pub severity: Severity,
/// Issue type/category — stored as string since LLM output varies.
/// Common values: security, performance, bug, best_practice, style, suggestion
#[serde(rename = "type", alias = "issue_type")]
pub issue_type: Option<IssueType>,
pub issue_type: Option<String>,
pub title: String,
pub body: String,
#[serde(default)]
Expand Down