sphinx-doc / sphinx-doc/sphinx
validate function/method params against docstrings
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
hi, we are using sphinx-apidoc to generate docs
sphinx-apidoc --output-dir docs/kw --no-toc kw && make --directory=docs html
but devs often forget to update docstrings after changing methods/functions. Is there a tool that is able to validate this? I saw stackoverflow question, but no answer there.
Maybe out of scope, but we are at least checking for warnings/errors from sphinx with this CI step:
docs-valid:
stage: test
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-py3
cache:
key: ${CI_PROJECT_PATH_SLUG}-sphinx
paths:
- .doctree/
script:
- >
sphinx-apidoc --output-dir docs/kw --no-toc kw
&& BOOKING_LOGGING_STD_DISABLED=1
OUTPUT=$(sphinx-build -M html docs docs/_build -q 2>&1 -d .doctree -j 8) || (echo "$OUTPUT"; exit 1);
echo "$OUTPUT" | grep -E ':[0-9]+: (WARNING|ERROR|SEVERE):' || exit 0;
echo 'Invalid docstring syntax. Check syntax here -> http://rst.ninjs.org'
&& exit 1
Would be cool if there would be single flag on sphinx-build that would fail on errors/warnings.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the sphinx-apidoc and sphinx-build commands shown in the issue, then inspect how Sphinx handles docstring parameter validation and build warnings. The issue is done when the supported validation behavior and a way to make the documented CI step fail on warnings or errors are clearly defined and tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ci-cd, documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100