refactor: Remove redundant doc comments throughout codebase
Removes module-level doc comments (//! lines) and excessive inline doc comments that were duplicating information already evident from: - Function/struct names (self-documenting code) - Type signatures (the what is clear from types) - Implementation context (the how is clear from code) Affected modules: - cli/* - Removed command descriptions duplicating clap help text - core/* - Removed module headers and obvious function docs - documents/* - Removed extractor/regenerator/truncation docs - embedding/* - Removed pipeline and chunking docs - gitlab/* - Removed client and transformer docs (kept type definitions) - ingestion/* - Removed orchestrator and ingestion docs - search/* - Removed FTS and vector search docs Philosophy: Code should be self-documenting. Comments should explain "why" (business decisions, non-obvious constraints) not "what" (which the code itself shows). This change reduces noise and maintenance burden while keeping the codebase just as understandable. Retains comments for: - Non-obvious business logic - Important safety invariants - Complex algorithm explanations - Public API boundaries where generated docs matter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,14 +2,7 @@ use rusqlite::Connection;
|
||||
|
||||
use super::error::{LoreError, Result};
|
||||
|
||||
/// Resolve a project string to a project_id using cascading match:
|
||||
/// 1. Exact match on path_with_namespace
|
||||
/// 2. Case-insensitive exact match
|
||||
/// 3. Suffix match (e.g., "auth-service" matches "group/auth-service") — only if unambiguous
|
||||
/// 4. Substring match (e.g., "typescript" matches "vs/typescript-code") — only if unambiguous
|
||||
/// 5. Error with available projects list
|
||||
pub fn resolve_project(conn: &Connection, project_str: &str) -> Result<i64> {
|
||||
// Step 1: Exact match
|
||||
let exact = conn.query_row(
|
||||
"SELECT id FROM projects WHERE path_with_namespace = ?1",
|
||||
rusqlite::params![project_str],
|
||||
@@ -19,7 +12,6 @@ pub fn resolve_project(conn: &Connection, project_str: &str) -> Result<i64> {
|
||||
return Ok(id);
|
||||
}
|
||||
|
||||
// Step 2: Case-insensitive exact match
|
||||
let ci = conn.query_row(
|
||||
"SELECT id FROM projects WHERE LOWER(path_with_namespace) = LOWER(?1)",
|
||||
rusqlite::params![project_str],
|
||||
@@ -29,7 +21,6 @@ pub fn resolve_project(conn: &Connection, project_str: &str) -> Result<i64> {
|
||||
return Ok(id);
|
||||
}
|
||||
|
||||
// Step 3: Suffix match (unambiguous)
|
||||
let mut suffix_stmt = conn.prepare(
|
||||
"SELECT id, path_with_namespace FROM projects
|
||||
WHERE path_with_namespace LIKE '%/' || ?1
|
||||
@@ -59,7 +50,6 @@ pub fn resolve_project(conn: &Connection, project_str: &str) -> Result<i64> {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Step 4: Case-insensitive substring match (unambiguous)
|
||||
let mut substr_stmt = conn.prepare(
|
||||
"SELECT id, path_with_namespace FROM projects
|
||||
WHERE LOWER(path_with_namespace) LIKE '%' || LOWER(?1) || '%'",
|
||||
@@ -88,7 +78,6 @@ pub fn resolve_project(conn: &Connection, project_str: &str) -> Result<i64> {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Step 5: No match — list available projects
|
||||
let mut all_stmt =
|
||||
conn.prepare("SELECT path_with_namespace FROM projects ORDER BY path_with_namespace")?;
|
||||
let all_projects: Vec<String> = all_stmt
|
||||
@@ -211,7 +200,6 @@ mod tests {
|
||||
let conn = setup_db();
|
||||
insert_project(&conn, 1, "vs/python-code");
|
||||
insert_project(&conn, 2, "vs/typescript-code");
|
||||
// "code" matches both projects
|
||||
let err = resolve_project(&conn, "code").unwrap_err();
|
||||
let msg = err.to_string();
|
||||
assert!(
|
||||
@@ -225,11 +213,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_suffix_preferred_over_substring() {
|
||||
// Suffix match (step 3) should resolve before substring (step 4)
|
||||
let conn = setup_db();
|
||||
insert_project(&conn, 1, "backend/auth-service");
|
||||
insert_project(&conn, 2, "backend/auth-service-v2");
|
||||
// "auth-service" is an exact suffix of project 1
|
||||
let id = resolve_project(&conn, "auth-service").unwrap();
|
||||
assert_eq!(id, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user