Fix clippy warnings and fmt issues to pass CI
All checks were successful
CI / Format (push) Successful in 23s
CI / Clippy (push) Successful in 2m50s
CI / Security Audit (push) Has been skipped
CI / Tests (push) Has been skipped
CI / Format (pull_request) Successful in 2s
CI / Clippy (pull_request) Successful in 2m48s
CI / Security Audit (pull_request) Has been skipped
CI / Tests (pull_request) Has been skipped
All checks were successful
CI / Format (push) Successful in 23s
CI / Clippy (push) Successful in 2m50s
CI / Security Audit (push) Has been skipped
CI / Tests (push) Has been skipped
CI / Format (pull_request) Successful in 2s
CI / Clippy (pull_request) Successful in 2m48s
CI / Security Audit (pull_request) Has been skipped
CI / Tests (pull_request) Has been skipped
Replace expect/unwrap calls with safe alternatives, add Default impls for parser structs and Toasts, fix redundant closures, collapse nested ifs, remove unused import, and allow recursive-only-self/too-many-args lints in compliance-graph. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -307,8 +307,7 @@ pub async fn delete_repository(
|
|||||||
Extension(agent): AgentExt,
|
Extension(agent): AgentExt,
|
||||||
Path(id): Path<String>,
|
Path(id): Path<String>,
|
||||||
) -> Result<Json<serde_json::Value>, StatusCode> {
|
) -> Result<Json<serde_json::Value>, StatusCode> {
|
||||||
let oid =
|
let oid = mongodb::bson::oid::ObjectId::parse_str(&id).map_err(|_| StatusCode::BAD_REQUEST)?;
|
||||||
mongodb::bson::oid::ObjectId::parse_str(&id).map_err(|_| StatusCode::BAD_REQUEST)?;
|
|
||||||
let db = &agent.db;
|
let db = &agent.db;
|
||||||
|
|
||||||
// Delete the repository
|
// Delete the repository
|
||||||
@@ -333,10 +332,7 @@ pub async fn delete_repository(
|
|||||||
.await;
|
.await;
|
||||||
let _ = db.graph_nodes().delete_many(doc! { "repo_id": &id }).await;
|
let _ = db.graph_nodes().delete_many(doc! { "repo_id": &id }).await;
|
||||||
let _ = db.graph_edges().delete_many(doc! { "repo_id": &id }).await;
|
let _ = db.graph_edges().delete_many(doc! { "repo_id": &id }).await;
|
||||||
let _ = db
|
let _ = db.graph_builds().delete_many(doc! { "repo_id": &id }).await;
|
||||||
.graph_builds()
|
|
||||||
.delete_many(doc! { "repo_id": &id })
|
|
||||||
.await;
|
|
||||||
let _ = db
|
let _ = db
|
||||||
.impact_analyses()
|
.impact_analyses()
|
||||||
.delete_many(doc! { "repo_id": &id })
|
.delete_many(doc! { "repo_id": &id })
|
||||||
|
|||||||
@@ -244,6 +244,7 @@ pub struct DastFinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl DastFinding {
|
impl DastFinding {
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
scan_run_id: String,
|
scan_run_id: String,
|
||||||
target_id: String,
|
target_id: String,
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ pub struct Toasts {
|
|||||||
next_id: Signal<usize>,
|
next_id: Signal<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for Toasts {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Toasts {
|
impl Toasts {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
@@ -65,10 +65,7 @@ pub async fn add_repository(
|
|||||||
pub async fn delete_repository(repo_id: String) -> Result<(), ServerFnError> {
|
pub async fn delete_repository(repo_id: String) -> Result<(), ServerFnError> {
|
||||||
let state: super::server_state::ServerState =
|
let state: super::server_state::ServerState =
|
||||||
dioxus_fullstack::FullstackContext::extract().await?;
|
dioxus_fullstack::FullstackContext::extract().await?;
|
||||||
let url = format!(
|
let url = format!("{}/api/v1/repositories/{repo_id}", state.agent_api_url);
|
||||||
"{}/api/v1/repositories/{repo_id}",
|
|
||||||
state.agent_api_url
|
|
||||||
);
|
|
||||||
|
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
let resp = client
|
let resp = client
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ use dioxus::prelude::*;
|
|||||||
|
|
||||||
use crate::app::Route;
|
use crate::app::Route;
|
||||||
use crate::components::page_header::PageHeader;
|
use crate::components::page_header::PageHeader;
|
||||||
use crate::infrastructure::chat::fetch_embedding_status;
|
|
||||||
use crate::infrastructure::repositories::fetch_repositories;
|
use crate::infrastructure::repositories::fetch_repositories;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ pub fn DastFindingsPage() -> Element {
|
|||||||
}
|
}
|
||||||
td {
|
td {
|
||||||
Link {
|
Link {
|
||||||
to: Route::DastFindingDetailPage { id: id },
|
to: Route::DastFindingDetailPage { id },
|
||||||
"{finding.get(\"title\").and_then(|v| v.as_str()).unwrap_or(\"-\")}"
|
"{finding.get(\"title\").and_then(|v| v.as_str()).unwrap_or(\"-\")}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ pub fn GraphExplorerPage(repo_id: String) -> Element {
|
|||||||
let mut inspector_open = use_signal(|| false);
|
let mut inspector_open = use_signal(|| false);
|
||||||
|
|
||||||
// Search state
|
// Search state
|
||||||
let mut search_query = use_signal(|| String::new());
|
let mut search_query = use_signal(String::new);
|
||||||
let mut search_results = use_signal(|| Vec::<serde_json::Value>::new());
|
let mut search_results = use_signal(Vec::<serde_json::Value>::new);
|
||||||
let mut file_filter = use_signal(|| String::new());
|
let mut file_filter = use_signal(String::new);
|
||||||
|
|
||||||
// Store serialized graph JSON in signals so use_effect can react to them
|
// Store serialized graph JSON in signals so use_effect can react to them
|
||||||
let mut nodes_json = use_signal(|| String::new());
|
let mut nodes_json = use_signal(String::new);
|
||||||
let mut edges_json = use_signal(|| String::new());
|
let mut edges_json = use_signal(String::new);
|
||||||
let mut graph_ready = use_signal(|| false);
|
let mut graph_ready = use_signal(|| false);
|
||||||
|
|
||||||
// When resource resolves, serialize the data into signals
|
// When resource resolves, serialize the data into signals
|
||||||
@@ -404,7 +404,7 @@ pub fn GraphExplorerPage(repo_id: String) -> Element {
|
|||||||
} else if node_count > 0 {
|
} else if node_count > 0 {
|
||||||
// Data exists but nodes array was empty (shouldn't happen)
|
// Data exists but nodes array was empty (shouldn't happen)
|
||||||
div { class: "loading", "Loading graph visualization..." }
|
div { class: "loading", "Loading graph visualization..." }
|
||||||
} else if matches!(&*graph_data.read(), None) {
|
} else if (*graph_data.read()).is_none() {
|
||||||
div { class: "loading", "Loading graph data..." }
|
div { class: "loading", "Loading graph data..." }
|
||||||
} else {
|
} else {
|
||||||
div { class: "graph-empty-state",
|
div { class: "graph-empty-state",
|
||||||
|
|||||||
@@ -95,8 +95,10 @@ impl WebCrawler {
|
|||||||
let document = Html::parse_document(&body);
|
let document = Html::parse_document(&body);
|
||||||
|
|
||||||
// Extract links
|
// Extract links
|
||||||
let link_selector = Selector::parse("a[href]")
|
let link_selector = match Selector::parse("a[href]") {
|
||||||
.unwrap_or_else(|_| Selector::parse("a").expect("valid selector"));
|
Ok(s) => s,
|
||||||
|
Err(_) => continue,
|
||||||
|
};
|
||||||
for element in document.select(&link_selector) {
|
for element in document.select(&link_selector) {
|
||||||
if let Some(href) = element.value().attr("href") {
|
if let Some(href) = element.value().attr("href") {
|
||||||
if let Some(absolute_url) = self.resolve_url(&base, &url, href) {
|
if let Some(absolute_url) = self.resolve_url(&base, &url, href) {
|
||||||
@@ -110,10 +112,14 @@ impl WebCrawler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract forms
|
// Extract forms
|
||||||
let form_selector = Selector::parse("form")
|
let form_selector = match Selector::parse("form") {
|
||||||
.unwrap_or_else(|_| Selector::parse("form").expect("valid selector"));
|
Ok(s) => s,
|
||||||
let input_selector = Selector::parse("input, select, textarea")
|
Err(_) => continue,
|
||||||
.unwrap_or_else(|_| Selector::parse("input").expect("valid selector"));
|
};
|
||||||
|
let input_selector = match Selector::parse("input, select, textarea") {
|
||||||
|
Ok(s) => s,
|
||||||
|
Err(_) => continue,
|
||||||
|
};
|
||||||
|
|
||||||
for form in document.select(&form_selector) {
|
for form in document.select(&form_selector) {
|
||||||
let action = form.value().attr("action").unwrap_or("");
|
let action = form.value().attr("action").unwrap_or("");
|
||||||
|
|||||||
@@ -121,10 +121,10 @@ impl ReconAgent {
|
|||||||
|
|
||||||
let body_lower = body.to_lowercase();
|
let body_lower = body.to_lowercase();
|
||||||
for (tech, pattern) in &patterns {
|
for (tech, pattern) in &patterns {
|
||||||
if body_lower.contains(&pattern.to_lowercase()) {
|
if body_lower.contains(&pattern.to_lowercase())
|
||||||
if !result.technologies.contains(&tech.to_string()) {
|
&& !result.technologies.contains(&tech.to_string())
|
||||||
result.technologies.push(tech.to_string());
|
{
|
||||||
}
|
result.technologies.push(tech.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ pub fn detect_communities(code_graph: &CodeGraph) -> u32 {
|
|||||||
let mut comm_remap: HashMap<u32, u32> = HashMap::new();
|
let mut comm_remap: HashMap<u32, u32> = HashMap::new();
|
||||||
let mut next_id: u32 = 0;
|
let mut next_id: u32 = 0;
|
||||||
for &c in community.values() {
|
for &c in community.values() {
|
||||||
if !comm_remap.contains_key(&c) {
|
if let std::collections::hash_map::Entry::Vacant(e) = comm_remap.entry(c) {
|
||||||
comm_remap.insert(c, next_id);
|
e.insert(next_id);
|
||||||
next_id += 1;
|
next_id += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,8 +137,7 @@ pub fn detect_communities(code_graph: &CodeGraph) -> u32 {
|
|||||||
|
|
||||||
/// Apply community assignments back to code nodes
|
/// Apply community assignments back to code nodes
|
||||||
pub fn apply_communities(code_graph: &mut CodeGraph) -> u32 {
|
pub fn apply_communities(code_graph: &mut CodeGraph) -> u32 {
|
||||||
let count = detect_communities_with_assignment(code_graph);
|
detect_communities_with_assignment(code_graph)
|
||||||
count
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Detect communities and write assignments into the nodes
|
/// Detect communities and write assignments into the nodes
|
||||||
@@ -235,8 +234,8 @@ fn detect_communities_with_assignment(code_graph: &mut CodeGraph) -> u32 {
|
|||||||
let mut comm_remap: HashMap<u32, u32> = HashMap::new();
|
let mut comm_remap: HashMap<u32, u32> = HashMap::new();
|
||||||
let mut next_id: u32 = 0;
|
let mut next_id: u32 = 0;
|
||||||
for &c in community.values() {
|
for &c in community.values() {
|
||||||
if !comm_remap.contains_key(&c) {
|
if let std::collections::hash_map::Entry::Vacant(e) = comm_remap.entry(c) {
|
||||||
comm_remap.insert(c, next_id);
|
e.insert(next_id);
|
||||||
next_id += 1;
|
next_id += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,17 +96,15 @@ impl EmbeddingStore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if status == EmbeddingBuildStatus::Completed || status == EmbeddingBuildStatus::Failed {
|
if status == EmbeddingBuildStatus::Completed || status == EmbeddingBuildStatus::Failed {
|
||||||
update
|
if let Ok(set_doc) = update.get_document_mut("$set") {
|
||||||
.get_document_mut("$set")
|
set_doc.insert("completed_at", mongodb::bson::DateTime::now());
|
||||||
.unwrap()
|
}
|
||||||
.insert("completed_at", mongodb::bson::DateTime::now());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(msg) = error_message {
|
if let Some(msg) = error_message {
|
||||||
update
|
if let Ok(set_doc) = update.get_document_mut("$set") {
|
||||||
.get_document_mut("$set")
|
set_doc.insert("error_message", msg);
|
||||||
.unwrap()
|
}
|
||||||
.insert("error_message", msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.builds
|
self.builds
|
||||||
|
|||||||
@@ -133,10 +133,10 @@ impl GraphEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Try to resolve an edge target to a known node
|
/// Try to resolve an edge target to a known node
|
||||||
fn resolve_edge_target<'a>(
|
fn resolve_edge_target(
|
||||||
&self,
|
&self,
|
||||||
target: &str,
|
target: &str,
|
||||||
node_map: &'a HashMap<String, NodeIndex>,
|
node_map: &HashMap<String, NodeIndex>,
|
||||||
) -> Option<NodeIndex> {
|
) -> Option<NodeIndex> {
|
||||||
// Direct match
|
// Direct match
|
||||||
if let Some(idx) = node_map.get(target) {
|
if let Some(idx) = node_map.get(target) {
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#![allow(clippy::only_used_in_recursion)]
|
||||||
|
#![allow(clippy::too_many_arguments)]
|
||||||
|
|
||||||
pub mod graph;
|
pub mod graph;
|
||||||
pub mod parsers;
|
pub mod parsers;
|
||||||
pub mod search;
|
pub mod search;
|
||||||
|
|||||||
@@ -7,6 +7,12 @@ use tree_sitter::{Node, Parser};
|
|||||||
|
|
||||||
pub struct JavaScriptParser;
|
pub struct JavaScriptParser;
|
||||||
|
|
||||||
|
impl Default for JavaScriptParser {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl JavaScriptParser {
|
impl JavaScriptParser {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self
|
Self
|
||||||
|
|||||||
@@ -7,6 +7,12 @@ use tree_sitter::{Node, Parser};
|
|||||||
|
|
||||||
pub struct PythonParser;
|
pub struct PythonParser;
|
||||||
|
|
||||||
|
impl Default for PythonParser {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PythonParser {
|
impl PythonParser {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self
|
Self
|
||||||
|
|||||||
@@ -7,6 +7,12 @@ use tree_sitter::{Node, Parser};
|
|||||||
|
|
||||||
pub struct RustParser;
|
pub struct RustParser;
|
||||||
|
|
||||||
|
impl Default for RustParser {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl RustParser {
|
impl RustParser {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self
|
Self
|
||||||
|
|||||||
@@ -7,6 +7,12 @@ use tree_sitter::{Node, Parser};
|
|||||||
|
|
||||||
pub struct TypeScriptParser;
|
pub struct TypeScriptParser;
|
||||||
|
|
||||||
|
impl Default for TypeScriptParser {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl TypeScriptParser {
|
impl TypeScriptParser {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self
|
Self
|
||||||
|
|||||||
Reference in New Issue
Block a user