MAINT: Document D421 property-docstring noun-phrase convention#2102
Open
romanlutz wants to merge 5 commits into
Open
MAINT: Document D421 property-docstring noun-phrase convention#2102romanlutz wants to merge 5 commits into
romanlutz wants to merge 5 commits into
Conversation
Reword 118 @Property docstrings across 80 files from verb-style (`Return the X`, `Get the X`) to Google-style noun phrases (`The X`) to satisfy Ruff's D421 (property-docstring-starts-with-verb) rule. Docstring-only change with no behavior change; ruff check, ruff format --check, and the full unit test suite all pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add an explicit style-guide rule (with CORRECT/INCORRECT examples) that property docstrings must be noun phrases, not verb phrases, enforced by Ruff D421. Fix the existing verb-phrase example in the Property Decorators section, and add a clarifying comment near the ruff 'D' select entry explaining that 'D' + preview=true enables D421. 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.
Description
Documents the property-docstring noun-phrase convention that Ruff
D421(property-docstring-starts-with-verb) enforces acrosspyrit/**.D421is already active viaselect = ["D", ...]+preview = true, but the convention was never written down, so it could silently regress in review.This is the documentation counterpart to #2097 (which reworded all 118 property docstrings from verb phrases to noun phrases) and complements #2098 (which consolidated the Ruff per-file-ignores and dropped the dead
pyrit/uiconfig). No code or runtime changes.Changes:
.github/instructions/style-guide.instructions.md(Property Decorators): adds an explicit rule that property docstrings must read as noun phrases describing the value ("""The display name."""), not verb phrases ("""Return the display name."""), enforced by RuffD421, with a CORRECT/INCORRECT example pair. Also fixes the section's existing "CORRECT" example, which itself used a verb phrase ("""Check if the attack is complete.""") and would have violatedD421— now"""Whether the attack is complete.""", with the old form retained as a labeled INCORRECT example.pyproject.toml: adds a short comment above the"D"entry in[tool.ruff.lint] selectnoting that"D"+preview = trueenablesD421, and that"D"should stay selected (not ignored).Tests and Documentation
Documentation-only change (contributor style guide + a config comment); no code or API changes, so no new tests. Verified
uv run ruff check --select D421 .anduv run ruff check .both pass clean on the merged branch. Nodoc/notebooks were touched, so no JupyText run was needed.