Skip to content

[pydocstyle] Clarify which quote styles are allowed (D300)#22825

Merged
ntBre merged 1 commit intoastral-sh:mainfrom
Jkhall81:docs/fix-d300-clarification-20838
Jan 23, 2026
Merged

[pydocstyle] Clarify which quote styles are allowed (D300)#22825
ntBre merged 1 commit intoastral-sh:mainfrom
Jkhall81:docs/fix-d300-clarification-20838

Conversation

@Jkhall81
Copy link
Contributor

Summary

This PR updates the documentation for the D300 (triple-single-quotes) rule.

The description now explicitly mentions that the rule flags both single quotes (') and triple single quotes ('''). I've also added a Python example to show the single-quote violation.

Documentation was regenerated using cargo run -p ruff_dev -- generate-docs.

Fixes

Fixes #20838

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 23, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Comment on lines 10 to 11
/// Checks for docstrings that use single quotes (`'`) or triple single quotes (`'''`)
/// instead of triple double quotes (`"""`).
Copy link
Contributor

@ntBre ntBre Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One case not mentioned in the issue that it also looks like the rule covers is the use of non-triple double quotes:

def kos_root():
    "Return the pathname of the KOS root directory."

So the rule name is a bit misleading, but it essentially enforces triple double quotes. I think we could thus simplify the description to something like:

Suggested change
/// Checks for docstrings that use single quotes (`'`) or triple single quotes (`'''`)
/// instead of triple double quotes (`"""`).
/// Checks for docstrings that don't use `"""triple double quotes"""`.

Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! One suggestion on the phrasing and we should also not modify a generated file.

@ntBre ntBre added the documentation Improvements or additions to documentation label Jan 23, 2026
@Jkhall81 Jkhall81 force-pushed the docs/fix-d300-clarification-20838 branch from cb9f7b6 to 0632b8e Compare January 23, 2026 19:06
@Jkhall81 Jkhall81 requested a review from ntBre January 23, 2026 19:18
Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ntBre ntBre changed the title docs(rules): expand D300 description to include single quotes [pydocstyle] Clarify which quote styles are allowed (D300) Jan 23, 2026
@ntBre ntBre merged commit d78ba98 into astral-sh:main Jan 23, 2026
41 checks passed
carljm added a commit that referenced this pull request Jan 30, 2026
* main: (62 commits)
  [`refurb`] Do not add `abc.ABC` if already present (`FURB180`) (#22234)
  [ty] Add a new `assert-type-unspellable-subtype` diagnostic (#22815)
  [ty] Avoid duplicate syntax errors for `await` outside functions (#22826)
  [ty] Fix unary operator false-positive for constrained TypeVars (#22783)
  [ty] Fix binary operator false-positive for constrained TypeVars (#22782)
  [ty] Fix false-positive `unsupported-operator` for "symmetric" TypeVars (#22756)
  [`pydocstyle`] Clarify which quote styles are allowed (`D300`) (#22825)
  [ty] Use distributed versions of AND and OR on constraint sets (#22614)
  [ty] Add support for dict literals and dict() calls as default values for parameters with TypedDict types (#22161)
  Document `-` stdin convention in CLI help text (#22817)
  [ty] Make `infer_subscript_expression_types` a method on `Type` (#22731)
  [ty] Simplify `OverloadLiteral::spans` and `OverloadLiteral::parameter_span` (#22823)
  [ty] Require both `*args` and `**kwargs` when calling a `ParamSpec` callable (#22820)
  [ty] Handle tagged errors in conformance (#22746)
  Add `--color` cli option to force colored output (#22806)
  Identify notebooks by LSP didOpen instead of `.ipynb` file extension (#22810)
  [ty] Fix docstring rendering for literal blocks after doctests (#22676)
  [ty] Update salsa to fix out-of-order query validation (#22498)
  [ty] Inline cycle initial and recovery functions (#22814)
  [ty] Pass the generic context through the decorator (#22544)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing "What it does" details on D300

3 participants