ci: add GitHub Actions workflows with semantic-release auto-versioning
chore: fix all 702 clippy warnings across codebase - auto-fix 475 via cargo clippy --fix - fix remaining 227 manually: uninlined_format_args, redundant_closure, match_same_arms, underscore_binding, format_push_string, items_after_statements, needless_pass_by_value, clone_on_copy, case_sensitive_extension, single_match/let-else, write_with_newline, and other clippy lints
This commit is contained in:
+47
-41
@@ -72,12 +72,18 @@ fn is_production_code(path: &str) -> bool {
|
||||
if lower.contains("test") || lower.contains("spec") || lower.contains("_test.") {
|
||||
return false;
|
||||
}
|
||||
// Only source files
|
||||
lower.ends_with(".rs") || lower.ends_with(".ts") || lower.ends_with(".tsx")
|
||||
|| lower.ends_with(".js") || lower.ends_with(".jsx") || lower.ends_with(".go")
|
||||
|| lower.ends_with(".py") || lower.ends_with(".java") || lower.ends_with(".kt")
|
||||
|| lower.ends_with(".swift") || lower.ends_with(".c") || lower.ends_with(".cpp")
|
||||
|| lower.ends_with(".h") || lower.ends_with(".hpp")
|
||||
// Only source files — use Path::extension() to avoid clippy
|
||||
// case_sensitive_file_extension_comparisons lint
|
||||
std::path::Path::new(&lower)
|
||||
.extension()
|
||||
.and_then(|ext| ext.to_str())
|
||||
.is_some_and(|ext| {
|
||||
matches!(
|
||||
ext,
|
||||
"rs" | "ts" | "tsx" | "js" | "jsx" | "go" | "py" | "java" | "kt" | "swift"
|
||||
| "c" | "cpp" | "h" | "hpp"
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// ─── Inline Quick Review (synchronous, feeds back to LLM) ───
|
||||
@@ -111,7 +117,7 @@ pub fn spawn_quick_review(
|
||||
.with_system_prompt(prompt)
|
||||
.with_max_steps(QUICK_REVIEW_MAX_STEPS);
|
||||
|
||||
let mut ctx = build_subagent_context(def);
|
||||
let mut ctx = build_subagent_context(&def);
|
||||
ctx.session_dir = session_dir.to_path_buf();
|
||||
ctx.workspaces = workspaces.to_vec();
|
||||
|
||||
@@ -119,11 +125,11 @@ pub fn spawn_quick_review(
|
||||
let _drain = std::thread::spawn(move || {
|
||||
while let Some(event) = rx.blocking_recv() {
|
||||
match &event {
|
||||
SubagentEvent::ToolCall { _tool, .. } => {
|
||||
tracing::debug!("[auto-review] tool call: {}", _tool);
|
||||
SubagentEvent::ToolCall { tool, .. } => {
|
||||
tracing::debug!("[auto-review] tool call: {}", tool);
|
||||
}
|
||||
SubagentEvent::ToolResult { _tool, .. } => {
|
||||
tracing::debug!("[auto-review] tool result: {}", _tool);
|
||||
SubagentEvent::ToolResult { tool, .. } => {
|
||||
tracing::debug!("[auto-review] tool result: {}", tool);
|
||||
}
|
||||
SubagentEvent::Completed { .. } => {
|
||||
tracing::debug!("[auto-review] completed");
|
||||
@@ -133,7 +139,7 @@ pub fn spawn_quick_review(
|
||||
}
|
||||
});
|
||||
|
||||
let verdict = run_subagent(ctx, tx)?;
|
||||
let verdict = run_subagent(&ctx, &tx)?;
|
||||
tracing::info!(
|
||||
"[auto-review] quick review for '{}': {}",
|
||||
file_path,
|
||||
@@ -142,7 +148,7 @@ pub fn spawn_quick_review(
|
||||
Ok(verdict)
|
||||
}
|
||||
|
||||
/// ─── Background Subagent Spawners (async, report via SystemNote) ───
|
||||
/// ─── Background Subagent Spawners (async, report via `SystemNote`) ───
|
||||
///
|
||||
/// Spawn a background subagent that generates tests for modified files.
|
||||
///
|
||||
@@ -185,7 +191,7 @@ pub fn spawn_background_test_gen(
|
||||
.with_system_prompt(prompt)
|
||||
.with_max_steps(BG_SUBAGENT_MAX_STEPS);
|
||||
|
||||
let mut ctx = build_subagent_context(def);
|
||||
let mut ctx = build_subagent_context(&def);
|
||||
ctx.session_dir = sd;
|
||||
ctx.workspaces = ws;
|
||||
|
||||
@@ -193,17 +199,17 @@ pub fn spawn_background_test_gen(
|
||||
let _drain = std::thread::spawn(move || {
|
||||
while let Some(event) = rx.blocking_recv() {
|
||||
match &event {
|
||||
SubagentEvent::ToolCall { _tool, .. } => {
|
||||
tracing::debug!("[bg-test-gen] tool: {}", _tool);
|
||||
SubagentEvent::ToolCall { tool, .. } => {
|
||||
tracing::debug!("[bg-test-gen] tool: {}", tool);
|
||||
}
|
||||
SubagentEvent::ToolResult { _tool, .. } => {
|
||||
tracing::debug!("[bg-test-gen] result: {}", _tool);
|
||||
SubagentEvent::ToolResult { tool, .. } => {
|
||||
tracing::debug!("[bg-test-gen] result: {}", tool);
|
||||
}
|
||||
SubagentEvent::StepCompleted { _step, .. } => {
|
||||
tracing::trace!("[bg-test-gen] step {} done", _step);
|
||||
SubagentEvent::StepCompleted { .. } => {
|
||||
tracing::trace!("[bg-test-gen] step done");
|
||||
}
|
||||
SubagentEvent::StepFailed { _step, _error } => {
|
||||
tracing::warn!("[bg-test-gen] step {} failed: {}", _step, _error);
|
||||
SubagentEvent::StepFailed { step, error } => {
|
||||
tracing::warn!("[bg-test-gen] step {} failed: {}", step, error);
|
||||
}
|
||||
SubagentEvent::Completed { .. } => {
|
||||
tracing::debug!("[bg-test-gen] completed");
|
||||
@@ -212,13 +218,13 @@ pub fn spawn_background_test_gen(
|
||||
}
|
||||
});
|
||||
|
||||
let result = run_subagent(ctx, tx);
|
||||
let result = run_subagent(&ctx, &tx);
|
||||
let message = match &result {
|
||||
Ok(output) => {
|
||||
let first = output.lines().next().unwrap_or(output);
|
||||
format!("Auto test-gen: {}", first)
|
||||
format!("Auto test-gen: {first}")
|
||||
}
|
||||
Err(e) => format!("Auto test-gen failed: {}", e),
|
||||
Err(e) => format!("Auto test-gen failed: {e}"),
|
||||
};
|
||||
|
||||
if let Ok(mut q) = events.lock() {
|
||||
@@ -265,7 +271,7 @@ pub fn spawn_background_arch_review(
|
||||
.with_system_prompt(prompt)
|
||||
.with_max_steps(BG_SUBAGENT_MAX_STEPS);
|
||||
|
||||
let mut ctx = build_subagent_context(def);
|
||||
let mut ctx = build_subagent_context(&def);
|
||||
ctx.session_dir = sd;
|
||||
ctx.workspaces = ws;
|
||||
|
||||
@@ -273,11 +279,11 @@ pub fn spawn_background_arch_review(
|
||||
let _drain = std::thread::spawn(move || {
|
||||
while let Some(event) = rx.blocking_recv() {
|
||||
match &event {
|
||||
SubagentEvent::ToolCall { _tool, .. } => {
|
||||
tracing::debug!("[bg-arch] tool: {}", _tool);
|
||||
SubagentEvent::ToolCall { tool, .. } => {
|
||||
tracing::debug!("[bg-arch] tool: {}", tool);
|
||||
}
|
||||
SubagentEvent::ToolResult { _tool, .. } => {
|
||||
tracing::debug!("[bg-arch] result: {}", _tool);
|
||||
SubagentEvent::ToolResult { tool, .. } => {
|
||||
tracing::debug!("[bg-arch] result: {}", tool);
|
||||
}
|
||||
SubagentEvent::Completed { .. } => {
|
||||
tracing::debug!("[bg-arch] completed");
|
||||
@@ -287,13 +293,13 @@ pub fn spawn_background_arch_review(
|
||||
}
|
||||
});
|
||||
|
||||
let result = run_subagent(ctx, tx);
|
||||
let result = run_subagent(&ctx, &tx);
|
||||
let message = match &result {
|
||||
Ok(output) => {
|
||||
let first = output.lines().next().unwrap_or(output);
|
||||
format!("Architecture review: {}", first)
|
||||
format!("Architecture review: {first}")
|
||||
}
|
||||
Err(e) => format!("Architecture review failed: {}", e),
|
||||
Err(e) => format!("Architecture review failed: {e}"),
|
||||
};
|
||||
|
||||
if let Ok(mut q) = events.lock() {
|
||||
@@ -351,7 +357,7 @@ pub fn spawn_background_security_review(
|
||||
.with_system_prompt(prompt)
|
||||
.with_max_steps(BG_SUBAGENT_MAX_STEPS);
|
||||
|
||||
let mut ctx = build_subagent_context(def);
|
||||
let mut ctx = build_subagent_context(&def);
|
||||
ctx.session_dir = sd;
|
||||
ctx.workspaces = ws;
|
||||
|
||||
@@ -359,11 +365,11 @@ pub fn spawn_background_security_review(
|
||||
let _drain = std::thread::spawn(move || {
|
||||
while let Some(event) = rx.blocking_recv() {
|
||||
match &event {
|
||||
SubagentEvent::ToolCall { _tool, .. } => {
|
||||
tracing::debug!("[bg-security] tool: {}", _tool);
|
||||
SubagentEvent::ToolCall { tool, .. } => {
|
||||
tracing::debug!("[bg-security] tool: {}", tool);
|
||||
}
|
||||
SubagentEvent::ToolResult { _tool, .. } => {
|
||||
tracing::debug!("[bg-security] result: {}", _tool);
|
||||
SubagentEvent::ToolResult { tool, .. } => {
|
||||
tracing::debug!("[bg-security] result: {}", tool);
|
||||
}
|
||||
SubagentEvent::Completed { .. } => {
|
||||
tracing::debug!("[bg-security] completed");
|
||||
@@ -373,13 +379,13 @@ pub fn spawn_background_security_review(
|
||||
}
|
||||
});
|
||||
|
||||
let result = run_subagent(ctx, tx);
|
||||
let result = run_subagent(&ctx, &tx);
|
||||
let message = match &result {
|
||||
Ok(output) => {
|
||||
let first = output.lines().next().unwrap_or(output);
|
||||
format!("Security review: {}", first)
|
||||
format!("Security review: {first}")
|
||||
}
|
||||
Err(e) => format!("Security review failed: {}", e),
|
||||
Err(e) => format!("Security review failed: {e}"),
|
||||
};
|
||||
|
||||
if let Ok(mut q) = events.lock() {
|
||||
|
||||
Reference in New Issue
Block a user