Fix formatting and clippy warnings across workspace
- Run cargo fmt on all crates - Fix regex patterns using unsupported lookahead in patterns.rs - Replace unwrap() calls with compile_regex() helper - Fix never type fallback in GitHub tracker - Fix redundant field name in findings page - Allow enum_variant_names for Dioxus Route enum - Fix &mut Vec -> &mut [T] clippy lint in sbom.rs - Mark unused-but-intended APIs with #[allow(dead_code)] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,10 @@ pub async fn generate_pr_review(
|
||||
findings: &[Finding],
|
||||
) -> Result<(String, Vec<ReviewComment>), AgentError> {
|
||||
if findings.is_empty() {
|
||||
return Ok(("No security issues found in this PR.".to_string(), Vec::new()));
|
||||
return Ok((
|
||||
"No security issues found in this PR.".to_string(),
|
||||
Vec::new(),
|
||||
));
|
||||
}
|
||||
|
||||
let findings_text: Vec<String> = findings
|
||||
@@ -30,7 +33,10 @@ pub async fn generate_pr_review(
|
||||
severity = f.severity,
|
||||
title = f.title,
|
||||
file = f.file_path.as_deref().unwrap_or("unknown"),
|
||||
line = f.line_number.map(|n| n.to_string()).unwrap_or_else(|| "?".to_string()),
|
||||
line = f
|
||||
.line_number
|
||||
.map(|n| n.to_string())
|
||||
.unwrap_or_else(|| "?".to_string()),
|
||||
code = f.code_snippet.as_deref().unwrap_or("N/A"),
|
||||
rule = f.rule_id.as_deref().unwrap_or("N/A"),
|
||||
)
|
||||
@@ -43,7 +49,9 @@ pub async fn generate_pr_review(
|
||||
findings_text.join("\n"),
|
||||
);
|
||||
|
||||
let response = llm.chat(PR_REVIEW_SYSTEM_PROMPT, &user_prompt, Some(0.3)).await?;
|
||||
let response = llm
|
||||
.chat(PR_REVIEW_SYSTEM_PROMPT, &user_prompt, Some(0.3))
|
||||
.await?;
|
||||
|
||||
// Parse comments from LLM response
|
||||
let comments: Vec<ReviewComment> = serde_json::from_str::<Vec<PrComment>>(&response)
|
||||
@@ -61,7 +69,12 @@ pub async fn generate_pr_review(
|
||||
findings.len(),
|
||||
findings
|
||||
.iter()
|
||||
.map(|f| format!("- **[{}]** {} in `{}`", f.severity, f.title, f.file_path.as_deref().unwrap_or("unknown")))
|
||||
.map(|f| format!(
|
||||
"- **[{}]** {} in `{}`",
|
||||
f.severity,
|
||||
f.title,
|
||||
f.file_path.as_deref().unwrap_or("unknown")
|
||||
))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n"),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user