docs: fix 86 Sphinx ERRORs (PR 1 of 2-PR cleanup)#405
Merged
Conversation
…tion
PR 1 of a 2-PR Sphinx cleanup sequence. Drops baseline ERROR count from
86 to 0 in `make html` output, unblocking eventual `-W` enforcement in
docs-tests.yml. WARNING count drops collaterally from 2,199 to 2,170
(systemic duplicate-object-description class deferred to PR 2).
Class A - Undefined substitution references (~50 instances).
RST treats `|X|` as a substitution-reference; on `|ATT|`, `|overall ATT|`,
`|DID_M|`, `|h|`, `|Omega_0|`, `|delta_{...}|`, etc. with no defined
substitution, the build errors. Per-context fix:
- coef_var docstrings across results.py, *_results.py: `SE / |ATT|`
-> `SE / abs(ATT)` (plain English, readable in `help()`).
- imputation.py / two_stage.py horizon parameter: `|h|` -> `abs(h)`.
- imputation_results.py matrix-cardinality: `|Omega_1|` ->
`:math:\`|\Omega_1|\``.
- honest_did.py Delta-class smoothness/relative-magnitude restrictions:
inline `|delta_{t+1} - delta_t|` math -> `.. math::` block (DeltaSD,
DeltaRM) or inline `:math:` (DeltaSDRM list items), with `\delta`
LaTeX rendering.
- trop.py / trop_results.py / docs/api/trop.rst: `|s-t|` and `|t-s|` ->
`:math:\`|s-t|\``.
Class B - Unexpected indentation in numpydoc bullet lists.
RST requires a blank line between a colon-terminated description line
and the bullet list that follows. Affected sites use the same pattern:
parameter `X : type` description ending with `:`, then bullets without
blank line. Fix is a single inserted blank line per site, applied to:
- bacon.py:bacon_decompose (weights param + Returns block)
- staggered.py:CallawaySantAnna (rank_deficient_action, base_period,
pscore_fallback)
- triple_diff.py:TripleDifference (estimation_method,
rank_deficient_action, pscore_fallback)
- twfe.py:TwoWayFixedEffects.decompose (weights param)
- synthetic_did.py:SyntheticDiD (use-cases bullet list,
variance_method)
- prep.py:rank_control_units (Returns columns)
- had.py:HeterogeneousAdoptionDiDResults (se attribute bullets)
- results.py:SyntheticDiDResults.get_loo_effects_df (Available on,
Blocked on, Returns columns)
Other fixes:
- diagnostic_report.py:DiagnosticReport - collapsed multi-line
parameter name list (`run_parallel_trends, run_sensitivity, ...`) to
single line so RST recognizes the parameter group; replaced em-dash
with hyphen per repo convention.
- docs/api/local_linear.rst:48 - replaced `.. autodata:: KERNELS`
(which Sphinx tries to construct a docstring for via autodoc, hitting
RST parse errors on the surrounding source comments) with manual
`.. py:data::` directive carrying the same content.
Out of scope (queued):
- 2,170 systemic `duplicate object description` warnings from
page-level autoclass `:members:` overlapping with autosummary stubs
(PR 2: most likely add `:no-index:` to ~25-30 page-level directives
per Sphinx's recommended fix).
- Adding `-W` to `docs-tests.yml` (PR 3, after PR 2).
Verification:
- `make html`: 0 ERRORs (was 86), 2,170 WARNINGs (was 2,199).
- `pytest tests/test_doc_snippets.py`: 111 passed, 4 skipped (unchanged
baseline).
- 0 em-dashes in diff.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Overall Assessment✅ Looks good — No unmitigated P0/P1 findings found. Executive Summary
MethodologyFinding: No methodology defects.
Code QualityFinding: No code-quality blockers.
PerformanceFinding: No performance impact.
MaintainabilityFinding: Sibling documentation surfaces appear mirrored.
Tech DebtFinding: Remaining duplicate-object Sphinx warnings are tracked.
SecurityFinding: No security issues found.
Documentation/TestsFinding: Documentation cleanup is consistent with the PR scope.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR 1 of a 2-PR Sphinx cleanup sequence. Drops
make htmlERROR countfrom 86 to 0, unblocking eventual
-Wenforcement indocs-tests.yml.WARNING count drops collaterally from 2,199 to 2,170. The systemic
~2,000
duplicate object descriptionclass is deferred to PR 2.Class A - Undefined substitution references (~50 instances). RST
treats
|X|as a substitution-reference; on|ATT|,|overall ATT|,|DID_M|,|h|,|Omega_0|,|delta_{...}|, etc. with no definedsubstitution, the build errors. Per-context fix:
coef_vardocstrings acrossresults.pyand 11*_results.pyfiles:
SE / |ATT|->SE / abs(ATT)(plain English, readable inhelp()).imputation.py/two_stage.pyhorizon parameter:|h|->abs(h).imputation_results.pymatrix-cardinality:|Omega_1|->:math:`|\Omega_1|`.honest_did.pyDelta-class smoothness/relative-magnituderestrictions: inline
|delta_{t+1} - delta_t|math ->.. math::block (
DeltaSD,DeltaRM) or inline:math:(DeltaSDRMlistitems), with
\deltaLaTeX rendering.trop.py/trop_results.py/docs/api/trop.rst:|s-t|and|t-s|->:math:`|s-t|`.Class B - Unexpected indentation in numpydoc bullet lists. RST
requires a blank line between a colon-terminated description line and
the bullet list that follows. Affected sites use the same pattern:
parameter
X : typedescription ending with:, then bullets withoutblank line. Fix is a single inserted blank line per site, applied to
docstrings in:
bacon_decompose,staggered.CallawaySantAnna,triple_diff.TripleDifference,twfe.TwoWayFixedEffects.decompose,synthetic_did.SyntheticDiD,prep.rank_control_units,had.HeterogeneousAdoptionDiDResults, andresults.SyntheticDiDResults.get_loo_effects_df.Other fixes:
diagnostic_report.py:DiagnosticReport: collapsed multi-lineparameter name list (
run_parallel_trends, run_sensitivity, ...)to single line so RST recognizes the parameter group; replaced
em-dash with hyphen per repo convention.
docs/api/local_linear.rst:48: replaced.. autodata:: KERNELS(which Sphinx tries to construct a docstring for via autodoc,
hitting RST parse errors on the surrounding source comments) with
manual
.. py:data::directive carrying the same content.Methodology references
N/A - all changes are RST formatting in docstrings or RST source. No
estimator logic, defaults, weighting, or inference behavior changed.
Validation
make html: 0 ERRORs (was 86), 2,170 WARNINGs (was 2,199).pytest tests/test_doc_snippets.py: 111 passed, 4 skipped (unchangedBatch C baseline; new RST in
local_linear.rsthas no code-blocks).git diff origin/main...HEAD | grep '^+' | grep -c '—'returns 0.*.py(docstring formatting only) +docs/api/local_linear.rst+docs/api/trop.rst. No test changesneeded (no behavior change).
Out of scope (queued)
duplicate object descriptionwarnings:members:overlapping with checked-in autosummary stubs. Most likely add:no-index:to ~25-30 page-level directives indocs/api/*.rstper Sphinx's recommended fix. Architectural decision worth its own plan + review.-Wtodocs-tests.ymlbuildBuild docsstep withSPHINXOPTS="-W". Locks in the cleanup permanently.Security / privacy
Generated with Claude Code