DOC: Replace reST cross-reference roles in docstrings with plain backticks#1782
Open
romanlutz wants to merge 2 commits into
Open
DOC: Replace reST cross-reference roles in docstrings with plain backticks#1782romanlutz wants to merge 2 commits into
romanlutz wants to merge 2 commits into
Conversation
…ticks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Why
PyRIT's docs build uses MyST (Markdown-flavoured), not reStructuredText.
reST cross-reference roles like
:class:SeedPrompt,:func:oo,:meth:�aretc. render as raw text under MyST and are inconsistent with the prevailing convention — plain double-backtick code spans inside Google-style docstrings (see e.g. pyrit/datasets/seed_datasets/remote/visual_leak_bench_dataset.py and pyrit/datasets/seed_datasets/remote/harmbench_multimodal_dataset.py).A reviewer flagged this on pyrit/datasets/seed_datasets/remote/mossbench_dataset.py and it was fixed there in a follow-up commit. This PR audits and fixes the rest of the repo, and adds a style-guide rule to prevent recurrence.
What changed
Audit + fix (Part 1)
Searched
pyrit/,tests/,doc/for reST role syntax in docstrings/comments. Found 55 occurrences across 17.pyfiles (zero hits in.md/.ipynb)::class::func::meth::data::py:func:Every occurrence was rewritten from
:role:NametoName. Pure docstring/comment text changes — no logic or signature changes.Style rule (Part 2)
Added a "Code references in docstrings" subsection to
.github/instructions/style-guide.instructions.mdunder Documentation Standards → Docstring Format. Its existingapplyTo: '**/*.py'front-matter ensures Copilot picks it up for every Python file. The rule:{class}Namealternative only as a rare fallback — the default in PyRIT is plain backticks, not cross-references.Also added a checklist item to the "Final Checklist" near the end of the file.
Verification
uv run ruff check— passesuv run ruff format --check— all 17 files already formatteduv run pre-commit run --files <changed>— all hooks pass (trailing whitespace, EOF, ruff, ty, etc.)uv run pyteston changed-module test files — 146/146 passedpyrit/,tests/, ordoc/.