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,11 +1,6 @@
|
||||
//! Custom error types for gitlore.
|
||||
//!
|
||||
//! Uses thiserror for ergonomic error definitions with structured error codes.
|
||||
|
||||
use serde::Serialize;
|
||||
use thiserror::Error;
|
||||
|
||||
/// Error codes for programmatic error handling.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ErrorCode {
|
||||
ConfigNotFound,
|
||||
@@ -55,7 +50,6 @@ impl std::fmt::Display for ErrorCode {
|
||||
}
|
||||
|
||||
impl ErrorCode {
|
||||
/// Get the exit code for this error (for robot mode).
|
||||
pub fn exit_code(&self) -> i32 {
|
||||
match self {
|
||||
Self::InternalError => 1,
|
||||
@@ -80,7 +74,6 @@ impl ErrorCode {
|
||||
}
|
||||
}
|
||||
|
||||
/// Main error type for gitlore.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum LoreError {
|
||||
#[error("Config file not found at {path}. Run \"lore init\" first.")]
|
||||
@@ -163,7 +156,6 @@ pub enum LoreError {
|
||||
}
|
||||
|
||||
impl LoreError {
|
||||
/// Get the error code for programmatic handling.
|
||||
pub fn code(&self) -> ErrorCode {
|
||||
match self {
|
||||
Self::ConfigNotFound { .. } => ErrorCode::ConfigNotFound,
|
||||
@@ -190,7 +182,6 @@ impl LoreError {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get a suggestion for how to fix this error, including inline examples.
|
||||
pub fn suggestion(&self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::ConfigNotFound { .. } => Some(
|
||||
@@ -240,21 +231,14 @@ impl LoreError {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether this error represents a permanent API failure that should not be retried.
|
||||
///
|
||||
/// Only 404 (not found) is truly permanent: the resource doesn't exist and never will.
|
||||
/// 403 and auth errors are NOT permanent — they may be environmental (VPN down,
|
||||
/// token rotation, temporary restrictions) and should be retried with backoff.
|
||||
pub fn is_permanent_api_error(&self) -> bool {
|
||||
matches!(self, Self::GitLabNotFound { .. })
|
||||
}
|
||||
|
||||
/// Get the exit code for this error.
|
||||
pub fn exit_code(&self) -> i32 {
|
||||
self.code().exit_code()
|
||||
}
|
||||
|
||||
/// Convert to robot-mode JSON error output.
|
||||
pub fn to_robot_error(&self) -> RobotError {
|
||||
RobotError {
|
||||
code: self.code().to_string(),
|
||||
@@ -264,7 +248,6 @@ impl LoreError {
|
||||
}
|
||||
}
|
||||
|
||||
/// Structured error for robot mode JSON output.
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct RobotError {
|
||||
pub code: String,
|
||||
@@ -273,7 +256,6 @@ pub struct RobotError {
|
||||
pub suggestion: Option<String>,
|
||||
}
|
||||
|
||||
/// Wrapper for robot mode error output.
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct RobotErrorOutput {
|
||||
pub error: RobotError,
|
||||
|
||||
Reference in New Issue
Block a user