Skip to content

Doc-quality validator (doc_lint.py) over the docs-JSON IR#1

Merged
jturney merged 1 commit into
mainfrom
feature/doc-quality-validator
Jun 3, 2026
Merged

Doc-quality validator (doc_lint.py) over the docs-JSON IR#1
jturney merged 1 commit into
mainfrom
feature/doc-quality-validator

Conversation

@jturney

@jturney jturney commented Jun 3, 2026

Copy link
Copy Markdown
Member

What

Adds scripts/doc_lint.py — a doc-quality validator that cross-checks each
callable's parsed doc comment against its real signature, using only the
existing apiary --emit-cpp-docs-json output. No C++ changes: the IR already
carries params/template_params/return_type plus the parsed
@param/@tparam/@return/@throws, so this is a pure-Python checker over
the JSON.

This is feature #2 from the Apiary tool-ideas list — turning documentation
drift into a CI gate instead of something discovered at render time.

Checks

check severity fires when
unknown-param / unknown-tparam error a @param/@tparam names something the signature doesn't have (typo/renamed/removed)
missing-param / missing-tparam warning a parameter/tparam is undocumented while its siblings are (partial docs → likely an oversight)
returns-on-void warning @return text on a void function
malformed-throws warning @throws with no exception type

Diagnostics print as file:line:col: severity: message [check] (editor/CI
parseable); exit is non-zero on any error (or any warning under --strict).
--select runs a subset; --format json for machine consumption. Handles
nested classes, constructors, and function-like macros.

Tests / CI

  • Seeded-drift JSON fixture + golden + run_doc_lint.sh, registered as the
    apiary_doc_lint ctest (pure Python — needs no apiary binary).
  • ci.yml: add python so the ctest runs.
  • pages.yml: dogfood gate — lint apiary's own generated docs --strict
    (currently 0 findings), so doc drift can't regress.

Packaging

doc_lint.py lives in scripts/, which the recipe already installs, so
consumers get share/apiary/scripts/doc_lint.py to run over their own JSON.

Follow-on (not in this PR)

The coverage ratchet half (baseline the --report-undocumented count, fail
CI on increase). Undocumented entities aren't in the docs-JSON (the docs filter
requires a comment), so the ratchet needs the tool's stderr count — and it's
more naturally a consumer-side gate.

🤖 Generated with Claude Code

jturney added a commit that referenced this pull request Jun 3, 2026
The static `group: pages` (cancel-in-progress: true) put push-to-main and PR
runs in the same group, so opening PR #1 cancelled main's in-flight docs run.
Key the build concurrency by ${{ github.workflow }}-${{ github.ref }} so refs
are independent (a newer push to the same ref still supersedes), and give the
deploy job its own `pages-deploy` group with cancel-in-progress: false to
serialize real deployments without killing one mid-flight.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cross-checks each callable's parsed doc comment against its real signature,
using only the existing --emit-cpp-docs-json output (no C++ changes):

  - @param / @tparam naming something the signature lacks       -> error
  - a parameter/tparam left undocumented when siblings are       -> warning
  - @return text on a void function                              -> warning
  - a malformed @throws with no exception type                   -> warning

Diagnostics print as `file:line:col: severity: message [check]` (editor/CI
parseable); exit is non-zero on any error (or any warning under --strict).
--select runs a subset of checks; --format json for machine consumption.

- scripts/doc_lint.py: the validator (stdlib only; installed via scripts/).
- tests/: seeded-drift JSON fixture + golden + run_doc_lint.sh, registered
  as the apiary_doc_lint ctest (pure Python, needs no apiary binary).
- ci.yml: add python so the ctest runs.
- pages.yml: dogfood gate — lint apiary's own generated docs --strict
  (currently 0 findings) so doc drift can't regress.

This is feature #2 from the Apiary tool-ideas list (doc-quality validator).
The coverage ratchet half (baseline the --report-undocumented count, fail on
increase) is a natural follow-on and is more naturally a consumer-side CI gate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jturney jturney force-pushed the feature/doc-quality-validator branch from abe35f4 to 133f450 Compare June 3, 2026 16:09
@jturney jturney merged commit 6910b55 into main Jun 3, 2026
3 checks passed
@jturney jturney deleted the feature/doc-quality-validator branch June 3, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant