pdftract/scripts/check_doc_coverage.sh
jedarden 225f96c241 fix(pyo3): correct extract_text_fn call in extract_markdown stub
The extract_markdown stub was calling extract_text instead of
extract_text_fn, causing a compilation error. This fixes the
function name to match the exported function from extract_text.rs.

This completes the extract_text PyO3 entry point implementation,
which was already present in extract_text.rs and lib.rs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 20:28:25 -04:00

48 lines
1.8 KiB
Bash
Executable file

#!/usr/bin/env bash
# Check documentation coverage for pdftract-core public API
# Reports:
# 1. Public items without any documentation
# 2. Public items with documentation but no examples
# 3. Overall coverage percentage
set -euo pipefail
cd "$(dirname "$0")/.."
echo "=== Checking rustdoc coverage for pdftract-core ==="
echo ""
# Count public items
echo "Counting public items..."
pub_items=$(grep -rh "^pub fn\|^pub struct\|^pub enum\|^pub trait\|^pub const\|^pub type\|^pub mod" crates/pdftract-core/src --include="*.rs" | wc -l)
echo "Total public items: $pub_items"
echo ""
# Try cargo doc to see warnings
echo "Running cargo doc to check for missing_docs warnings..."
timeout 300 cargo doc --no-deps --all-features -p pdftract-core 2>&1 | grep -i "missing.*doc" | head -20 || echo "No missing_docs warnings found in initial scan"
echo ""
# Check specific high-impact modules
echo "=== Checking key modules for example coverage ==="
for module in extract options schema confidence span glyph table layout; do
file="crates/pdftract-core/src/${module}.rs"
if [[ -f "$file" ]]; then
echo "--- $module ---"
# Count public items
pub_count=$(grep "^pub fn\|^pub struct\|^pub enum\|^pub trait\|^pub const\|^pub type" "$file" | wc -l)
# Count items with examples
example_count=$(grep -c "^/// # Examples" "$file" 2>/dev/null || echo "0")
echo "Public items: $pub_count, Items with examples: $example_count"
fi
done
echo ""
# Manual check: show some items missing examples
echo "=== Sample items that may need examples ==="
grep -rn "^pub fn" crates/pdftract-core/src --include="*.rs" | head -20
echo ""
echo "=== Summary ==="
echo "Run 'cargo doc --no-deps --all-features -p pdftract-core' to see full warnings"
echo "Check individual modules by examining their /// comments for # Examples sections"