DOC: Replace reST cross-reference roles in docstrings with plain backticks#1782
Merged
Merged
Conversation
…ticks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
hannahwestra25
approved these changes
May 26, 2026
ValbuenaVC
pushed a commit
to ValbuenaVC/PyRIT
that referenced
this pull request
May 28, 2026
…ex copy Combines three small post-review cleanups in one commit: * Migrate :class: / :func: / :meth: reST roles to plain double-backtick code spans across files touched by this PR (adversarial.py, the two test modules, and the captured scenario-description output in the benchmark scanner notebook). Matches Rich's microsoft#1782 style-guide rule and the new docstring-style entry in .github/instructions/. * Rewrite the VERSION inline doc to describe the actual bump trigger (param + atomic_attack_name format change) and cache-scoping semantics (v1 results stay queryable but don't suppress v2 runs). * Simplify the objective_scorer Args block to reflect c7e7b93 (guard removed; annotation narrowed to TrueFalseScorer | None) and delete the now-lying Raises: TypeError section. * Inline _select_adversarial_specs at its single call site as a 2-line dict lookup and delete the method. The defensive double-filter (non-adversarial + drift warnings) is dead by construction since BenchmarkStrategy is built from adversarial-capable SCENARIO_TECHNIQUES entries only. Drop the corresponding TestSelectAdversarialSpecs class. * Delete TestAdversarialBenchmarkScorerFlexibility - its sole remaining test was a duplicate of test_construct_with_explicit_objective_scorer after the c7e7b93 guard removal. 43 unit tests pass (was 46 - -3 for the deletions). No source behavior change. 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/.