enforce 'rstcheck' checks - #8408
Conversation
| Here we provide a few examples of using ``cuml.accel``. The code for the | ||
| examples in this section is available in the cuML GitHub repository at `examples | ||
| <https://github.com/rapidsai/cuml/tree/HEAD/docs/source/cuml-accel/examples>`_. | ||
| examples in this section is available in the cuML GitHub repository at `<https://github.com/rapidsai/cuml/tree/HEAD/docs/source/cuml-accel/examples>`__. |
There was a problem hiding this comment.
There's a section title also called Examples in this page, which made the reference #examples ambiguous.
Changing this to an anonymous URL resolves that.
| accelerate: | ||
|
|
||
| .. code-block:: python | ||
| .. code-block:: ipython |
There was a problem hiding this comment.
Any of these code blocks with cell magic like %load_ext are reported as invalid syntax and Python code that follows them may not render correctly.
Using ipython fixes that. And works because cuML already uses a Sphinx extension to support that highlighting:
|
|
||
| You can find many more complete examples in the `Introductory Notebook | ||
| <estimator_intro.ipynb>`_ and in the cuML API documentation. | ||
| <estimator_intro.ipynb>`__ and in the cuML API documentation. |
There was a problem hiding this comment.
There are 2 references in this file both name "Introductory Notebook". Making these anonymous links resolves that.
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request adds rstcheck to pre-commit validation, configures its accepted directives and ignored messages, and updates documentation code-block and hyperlink markup. ChangesDocumentation tooling and markup
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pyproject.toml`:
- Around line 42-45: Restrict the rstcheck ignore pattern in ignore_messages to
the documented stable-anchor names or a narrowly defined anchor allowlist,
rather than matching every “Hyperlink target .* is not referenced” warning.
Preserve suppression for known intentional anchors while allowing typo and
dead-anchor warnings to surface.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 0c34c479-06c0-4c8a-b109-38fe1d56072c
📒 Files selected for processing (8)
.pre-commit-config.yamldocs/source/cuml-accel/examples/index.rstdocs/source/cuml-accel/faq.rstdocs/source/cuml-accel/index.rstdocs/source/cuml-accel/logging-and-profiling.rstdocs/source/cuml-accel/usage.rstdocs/source/cuml_intro.rstpyproject.toml
| ignore_messages = '''(?x)( | ||
| # ignore links that look "unused" because they're there to provide stable anchors in hyperlinks | ||
| Hyperlink\ target\ .*\ is\ not\ referenced | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Scope the rstcheck ignore to known anchors. Hyperlink target .* is not referenced suppresses every unreferenced-target warning, so typos and dead anchors will be missed; restrict this to explicit anchors or a narrower allowlist. pyproject.toml:42-45
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pyproject.toml` around lines 42 - 45, Restrict the rstcheck ignore pattern in
ignore_messages to the documented stable-anchor names or a narrowly defined
anchor allowlist, rather than matching every “Hyperlink target .* is not
referenced” warning. Preserve suppression for known intentional anchors while
allowing typo and dead-anchor warnings to surface.
|
|
||
| ignore_messages = '''(?x)( | ||
| # ignore links that look "unused" because they're there to provide stable anchors in hyperlinks | ||
| Hyperlink\ target\ .*\ is\ not\ referenced |
There was a problem hiding this comment.
Example of this:
Without this configuration, rstcheck reports:
docs/source/cuml_intro.rst:19: (INFO/1) Hyperlink target "where-possible-match-the-scikit-learn-api" is not referenced.
But we want to keep that, because it creates this anchor: https://docs.rapids.ai/api/cuml/nightly/cuml_intro/#where-possible-match-the-scikit-learn-api
Contributes to rapidsai/build-planning#262
Proposes introducing
rstcheck(rstcheck/rstcheck), a linter for ReStructuredText.In my experience, it runs pretty quickly and catches things that
sphinx-build -Wdoes not, like:.. code-block::blocksNotes for Reviewers
Planning to try this across all of RAPIDS, but starting here partially because @jcrist and I talked about
.rstlinting at SciPy 😊