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:
@@ -1,5 +1,3 @@
|
||||
//! Sync status command - display synchronization state from local database.
|
||||
|
||||
use console::style;
|
||||
use rusqlite::Connection;
|
||||
use serde::Serialize;
|
||||
@@ -13,7 +11,6 @@ use crate::core::time::{format_full_datetime, ms_to_iso};
|
||||
|
||||
const RECENT_RUNS_LIMIT: usize = 10;
|
||||
|
||||
/// Sync run information.
|
||||
#[derive(Debug)]
|
||||
pub struct SyncRunInfo {
|
||||
pub id: i64,
|
||||
@@ -28,7 +25,6 @@ pub struct SyncRunInfo {
|
||||
pub stages: Option<Vec<StageTiming>>,
|
||||
}
|
||||
|
||||
/// Cursor position information.
|
||||
#[derive(Debug)]
|
||||
pub struct CursorInfo {
|
||||
pub project_path: String,
|
||||
@@ -37,7 +33,6 @@ pub struct CursorInfo {
|
||||
pub tie_breaker_id: Option<i64>,
|
||||
}
|
||||
|
||||
/// Data summary counts.
|
||||
#[derive(Debug)]
|
||||
pub struct DataSummary {
|
||||
pub issue_count: i64,
|
||||
@@ -47,7 +42,6 @@ pub struct DataSummary {
|
||||
pub system_note_count: i64,
|
||||
}
|
||||
|
||||
/// Complete sync status result.
|
||||
#[derive(Debug)]
|
||||
pub struct SyncStatusResult {
|
||||
pub runs: Vec<SyncRunInfo>,
|
||||
@@ -55,7 +49,6 @@ pub struct SyncStatusResult {
|
||||
pub summary: DataSummary,
|
||||
}
|
||||
|
||||
/// Run the sync-status command.
|
||||
pub fn run_sync_status(config: &Config) -> Result<SyncStatusResult> {
|
||||
let db_path = get_db_path(config.storage.db_path.as_deref());
|
||||
let conn = create_connection(&db_path)?;
|
||||
@@ -71,7 +64,6 @@ pub fn run_sync_status(config: &Config) -> Result<SyncStatusResult> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Get the most recent sync runs.
|
||||
fn get_recent_sync_runs(conn: &Connection, limit: usize) -> Result<Vec<SyncRunInfo>> {
|
||||
let mut stmt = conn.prepare(
|
||||
"SELECT id, started_at, finished_at, status, command, error,
|
||||
@@ -105,7 +97,6 @@ fn get_recent_sync_runs(conn: &Connection, limit: usize) -> Result<Vec<SyncRunIn
|
||||
Ok(runs?)
|
||||
}
|
||||
|
||||
/// Get cursor positions for all projects/resource types.
|
||||
fn get_cursor_positions(conn: &Connection) -> Result<Vec<CursorInfo>> {
|
||||
let mut stmt = conn.prepare(
|
||||
"SELECT p.path_with_namespace, sc.resource_type, sc.updated_at_cursor, sc.tie_breaker_id
|
||||
@@ -128,7 +119,6 @@ fn get_cursor_positions(conn: &Connection) -> Result<Vec<CursorInfo>> {
|
||||
Ok(cursors?)
|
||||
}
|
||||
|
||||
/// Get data summary counts.
|
||||
fn get_data_summary(conn: &Connection) -> Result<DataSummary> {
|
||||
let issue_count: i64 = conn
|
||||
.query_row("SELECT COUNT(*) FROM issues", [], |row| row.get(0))
|
||||
@@ -159,7 +149,6 @@ fn get_data_summary(conn: &Connection) -> Result<DataSummary> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Format duration in milliseconds to human-readable string.
|
||||
fn format_duration(ms: i64) -> String {
|
||||
let seconds = ms / 1000;
|
||||
let minutes = seconds / 60;
|
||||
@@ -176,7 +165,6 @@ fn format_duration(ms: i64) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// Format number with thousands separators.
|
||||
fn format_number(n: i64) -> String {
|
||||
let is_negative = n < 0;
|
||||
let abs_n = n.unsigned_abs();
|
||||
@@ -198,10 +186,6 @@ fn format_number(n: i64) -> String {
|
||||
result
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// JSON output structures for robot mode
|
||||
// ============================================================================
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct SyncStatusJsonOutput {
|
||||
ok: bool,
|
||||
@@ -254,7 +238,6 @@ struct SummaryJsonInfo {
|
||||
system_notes: i64,
|
||||
}
|
||||
|
||||
/// Print sync status as JSON (robot mode).
|
||||
pub fn print_sync_status_json(result: &SyncStatusResult) {
|
||||
let runs = result
|
||||
.runs
|
||||
@@ -306,13 +289,7 @@ pub fn print_sync_status_json(result: &SyncStatusResult) {
|
||||
println!("{}", serde_json::to_string(&output).unwrap());
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Human-readable output
|
||||
// ============================================================================
|
||||
|
||||
/// Print sync status result.
|
||||
pub fn print_sync_status(result: &SyncStatusResult) {
|
||||
// Recent Runs section
|
||||
println!("{}", style("Recent Sync Runs").bold().underlined());
|
||||
println!();
|
||||
|
||||
@@ -330,7 +307,6 @@ pub fn print_sync_status(result: &SyncStatusResult) {
|
||||
|
||||
println!();
|
||||
|
||||
// Cursor Positions section
|
||||
println!("{}", style("Cursor Positions").bold().underlined());
|
||||
println!();
|
||||
|
||||
@@ -361,7 +337,6 @@ pub fn print_sync_status(result: &SyncStatusResult) {
|
||||
|
||||
println!();
|
||||
|
||||
// Data Summary section
|
||||
println!("{}", style("Data Summary").bold().underlined());
|
||||
println!();
|
||||
|
||||
@@ -390,7 +365,6 @@ pub fn print_sync_status(result: &SyncStatusResult) {
|
||||
);
|
||||
}
|
||||
|
||||
/// Print a single run as a compact one-liner.
|
||||
fn print_run_line(run: &SyncRunInfo) {
|
||||
let status_styled = match run.status.as_str() {
|
||||
"succeeded" => style(&run.status).green(),
|
||||
|
||||
Reference in New Issue
Block a user