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 @@
|
||||
//! Count command - display entity counts from local database.
|
||||
|
||||
use console::style;
|
||||
use rusqlite::Connection;
|
||||
use serde::Serialize;
|
||||
@@ -10,23 +8,20 @@ use crate::core::error::Result;
|
||||
use crate::core::events_db::{self, EventCounts};
|
||||
use crate::core::paths::get_db_path;
|
||||
|
||||
/// Result of count query.
|
||||
pub struct CountResult {
|
||||
pub entity: String,
|
||||
pub count: i64,
|
||||
pub system_count: Option<i64>, // For notes only
|
||||
pub state_breakdown: Option<StateBreakdown>, // For issues/MRs
|
||||
pub system_count: Option<i64>,
|
||||
pub state_breakdown: Option<StateBreakdown>,
|
||||
}
|
||||
|
||||
/// State breakdown for issues or MRs.
|
||||
pub struct StateBreakdown {
|
||||
pub opened: i64,
|
||||
pub closed: i64,
|
||||
pub merged: Option<i64>, // MRs only
|
||||
pub locked: Option<i64>, // MRs only
|
||||
pub merged: Option<i64>,
|
||||
pub locked: Option<i64>,
|
||||
}
|
||||
|
||||
/// Run the count command.
|
||||
pub fn run_count(config: &Config, entity: &str, type_filter: Option<&str>) -> Result<CountResult> {
|
||||
let db_path = get_db_path(config.storage.db_path.as_deref());
|
||||
let conn = create_connection(&db_path)?;
|
||||
@@ -45,7 +40,6 @@ pub fn run_count(config: &Config, entity: &str, type_filter: Option<&str>) -> Re
|
||||
}
|
||||
}
|
||||
|
||||
/// Count issues with state breakdown.
|
||||
fn count_issues(conn: &Connection) -> Result<CountResult> {
|
||||
let count: i64 = conn.query_row("SELECT COUNT(*) FROM issues", [], |row| row.get(0))?;
|
||||
|
||||
@@ -74,7 +68,6 @@ fn count_issues(conn: &Connection) -> Result<CountResult> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Count merge requests with state breakdown.
|
||||
fn count_mrs(conn: &Connection) -> Result<CountResult> {
|
||||
let count: i64 = conn.query_row("SELECT COUNT(*) FROM merge_requests", [], |row| row.get(0))?;
|
||||
|
||||
@@ -115,7 +108,6 @@ fn count_mrs(conn: &Connection) -> Result<CountResult> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Count discussions with optional noteable type filter.
|
||||
fn count_discussions(conn: &Connection, type_filter: Option<&str>) -> Result<CountResult> {
|
||||
let (count, entity_name) = match type_filter {
|
||||
Some("issue") => {
|
||||
@@ -149,7 +141,6 @@ fn count_discussions(conn: &Connection, type_filter: Option<&str>) -> Result<Cou
|
||||
})
|
||||
}
|
||||
|
||||
/// Count notes with optional noteable type filter.
|
||||
fn count_notes(conn: &Connection, type_filter: Option<&str>) -> Result<CountResult> {
|
||||
let (total, system_count, entity_name) = match type_filter {
|
||||
Some("issue") => {
|
||||
@@ -184,7 +175,6 @@ fn count_notes(conn: &Connection, type_filter: Option<&str>) -> Result<CountResu
|
||||
}
|
||||
};
|
||||
|
||||
// Non-system notes count
|
||||
let non_system = total - system_count;
|
||||
|
||||
Ok(CountResult {
|
||||
@@ -195,7 +185,6 @@ fn count_notes(conn: &Connection, type_filter: Option<&str>) -> Result<CountResu
|
||||
})
|
||||
}
|
||||
|
||||
/// Format number with thousands separators.
|
||||
fn format_number(n: i64) -> String {
|
||||
let s = n.to_string();
|
||||
let chars: Vec<char> = s.chars().collect();
|
||||
@@ -211,7 +200,6 @@ fn format_number(n: i64) -> String {
|
||||
result
|
||||
}
|
||||
|
||||
/// JSON output structure for count command.
|
||||
#[derive(Serialize)]
|
||||
struct CountJsonOutput {
|
||||
ok: bool,
|
||||
@@ -238,14 +226,12 @@ struct CountJsonBreakdown {
|
||||
locked: Option<i64>,
|
||||
}
|
||||
|
||||
/// Run the event count query.
|
||||
pub fn run_count_events(config: &Config) -> Result<EventCounts> {
|
||||
let db_path = get_db_path(config.storage.db_path.as_deref());
|
||||
let conn = create_connection(&db_path)?;
|
||||
events_db::count_events(&conn)
|
||||
}
|
||||
|
||||
/// JSON output structure for event counts.
|
||||
#[derive(Serialize)]
|
||||
struct EventCountJsonOutput {
|
||||
ok: bool,
|
||||
@@ -267,7 +253,6 @@ struct EventTypeCounts {
|
||||
total: usize,
|
||||
}
|
||||
|
||||
/// Print event counts as JSON (robot mode).
|
||||
pub fn print_event_count_json(counts: &EventCounts) {
|
||||
let output = EventCountJsonOutput {
|
||||
ok: true,
|
||||
@@ -294,7 +279,6 @@ pub fn print_event_count_json(counts: &EventCounts) {
|
||||
println!("{}", serde_json::to_string(&output).unwrap());
|
||||
}
|
||||
|
||||
/// Print event counts (human-readable).
|
||||
pub fn print_event_count(counts: &EventCounts) {
|
||||
println!(
|
||||
"{:<20} {:>8} {:>8} {:>8}",
|
||||
@@ -341,7 +325,6 @@ pub fn print_event_count(counts: &EventCounts) {
|
||||
);
|
||||
}
|
||||
|
||||
/// Print count result as JSON (robot mode).
|
||||
pub fn print_count_json(result: &CountResult) {
|
||||
let breakdown = result.state_breakdown.as_ref().map(|b| CountJsonBreakdown {
|
||||
opened: b.opened,
|
||||
@@ -363,7 +346,6 @@ pub fn print_count_json(result: &CountResult) {
|
||||
println!("{}", serde_json::to_string(&output).unwrap());
|
||||
}
|
||||
|
||||
/// Print count result.
|
||||
pub fn print_count(result: &CountResult) {
|
||||
let count_str = format_number(result.count);
|
||||
|
||||
@@ -386,7 +368,6 @@ pub fn print_count(result: &CountResult) {
|
||||
);
|
||||
}
|
||||
|
||||
// Print state breakdown if available
|
||||
if let Some(breakdown) = &result.state_breakdown {
|
||||
println!(" opened: {}", format_number(breakdown.opened));
|
||||
if let Some(merged) = breakdown.merged {
|
||||
|
||||
Reference in New Issue
Block a user