Skip to main content

fdu_core/
content.rs

1//! Optional, versioned file-content analysis.
2//!
3//! Metadata-only scans allocate none of these structures and open no file content.
4//!
5//! An analysis pass reads each file in 64 KiB chunks, schedules its candidates in
6//! bounded batches, classifies code lines in pieces over a bounded window
7//! ([`CodeAccumulator`]), and never truncates or size-skips an eligible file. One thing
8//! is retained whole per worker, because an exact answer needs it: the source of a
9//! Markdown file under the words unit, since the `CommonMark` parser resolves list
10//! tightness, headings, and references across the whole document. That is bounded at
11//! 64 MiB (`MARKDOWN_EXACT_BYTES`, stated with its reason in the analysis module): a
12//! larger Markdown file is counted as plain text and its record says so
13//! ([`CoverageReason::TextOnly`]). A file of another type retains at most its 16 KiB
14//! classification prefix and one chunk once the prefix has settled its type.
15
16mod content_analysis;
17mod content_basic_metrics;
18mod content_cache;
19mod content_code_metrics;
20mod content_index;
21mod content_markdown_metrics;
22mod content_model;
23
24pub use content_analysis::{AnalysisReport, AnalyzerCoverage, analyze_index};
25pub(crate) use content_analysis::{MARKDOWN_EXACT_BYTES, analyze_index_observed};
26pub use content_basic_metrics::{BasicAccumulator, TextAdmission};
27pub use content_cache::{
28    ContentCacheLoad, content_cache_path, load_content_cache, save_content_cache,
29};
30pub(crate) use content_cache::{content_sidecar_bytes, identify_sidecar};
31pub use content_code_metrics::CodeAccumulator;
32pub(crate) use content_index::ContentTierState;
33pub use content_index::{AnalyzerTally, ContentIndex, ContentRollUp, MetricTally};
34pub(crate) use content_model::{
35    AnalysisApplyOutcome, AnalysisCandidate, AnalysisObservation, RestoreCandidate,
36};
37pub use content_model::{
38    AnalysisRequest, AnalysisSet, AnalyzerId, AnalyzerOutcome, AnalyzerVersion, BasicMetrics,
39    CODE_SLOC, CONTENT_BASIC, CodeMetrics, ContentDetection, ContentProvenance, CoverageReason,
40    FileAnalysis, LogicalWordStats, MARKDOWN_PROSE, METRICS, MetricDef, MetricValues,
41    OptionsFingerprint, TEXT_LOGICAL, WordMetrics,
42};