Skip to content

MAINT: Document D421 property-docstring noun-phrase convention#2102

Open
romanlutz wants to merge 5 commits into
microsoft:mainfrom
romanlutz:romanlutz-lock-in-d421-docs
Open

MAINT: Document D421 property-docstring noun-phrase convention#2102
romanlutz wants to merge 5 commits into
microsoft:mainfrom
romanlutz:romanlutz-lock-in-d421-docs

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

Description

Documents the property-docstring noun-phrase convention that Ruff D421 (property-docstring-starts-with-verb) enforces across pyrit/**. D421 is already active via select = ["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/ui config). 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 Ruff D421, 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 violated D421 — 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] select noting that "D" + preview = true enables D421, 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 . and uv run ruff check . both pass clean on the merged branch. No doc/ notebooks were touched, so no JupyText run was needed.

biefan and others added 5 commits June 28, 2026 04:16
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants