pdftract/scripts/analyze-docs.sh
jedarden 1c6f26ecaa fix(bf-4mkhv): clean up unused imports in hash.rs
The bead description mentioned compile errors in hash.rs from API drift,
but those errors were either already fixed or misattributed. The API usage
was already correct:
- compute_fingerprint already takes 3 arguments with source
- len() already propagates Result with ?
- read_at method already used correctly
- Catalog fields accessed via trailer correctly

Only cleanup: removed unused std::fs::File and std::io imports.

Verification: notes/bf-4mkhv.md
2026-06-01 09:43:48 -04:00

27 lines
1 KiB
Bash
Executable file

#!/bin/bash
# Analyze rustdoc coverage by module
cd "$(dirname "$0")/.."
echo "=== MODULE-LEVEL DOC COVERAGE ANALYSIS ==="
echo ""
# For each module, count public items and examples
for mod_file in crates/pdftract-core/src/*.rs crates/pdftract-core/src/*/mod.rs; do
if [ -f "$mod_file" ]; then
rel_path="${mod_file#crates/pdftract-core/src/}"
mod_name="${rel_path%/mod.rs}"
mod_name="${mod_name%.rs}"
# Count public items in this file
pub_count=$(rg '^pub (fn|struct|enum|trait|type|mod) ' "$mod_file" --type rust -c 2>/dev/null || echo 0)
# Count example blocks
ex_count=$(rg '```rust' "$mod_file" --type rust -c 2>/dev/null || echo 0)
# Check for module-level doc
has_mod_doc=$(head -30 "$mod_file" | grep -c "^//!" || echo 0)
if [ "$pub_count" -gt 0 ] || [ "$mod_name" = "lib" ]; then
printf "%-30s pub:%3d ex:%2d mod_doc:%d\n" "$mod_name" "$pub_count" "$ex_count" "$has_mod_doc"
fi
fi
done | sort -t: -k2 -rn