Skip to content

[ruff] Allow docstrings in strict mode (RUF067) - #28679

Merged
ntBre merged 1 commit into
astral-sh:mainfrom
saberoueslati:ruf067/allow-init-docstrings
Oct 1, 2026
Merged

ntBre merged 1 commit into
astral-sh:mainfrom
saberoueslati:ruf067/allow-init-docstrings

Conversation

@saberoueslati

@saberoueslati saberoueslati commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #27416.

With lint.ruff.strictly-empty-init-modules = true, RUF067 flagged docstrings in __init__.py. Strict mode now allows module and attribute docstrings, as non-strict mode already does. Other code remains flagged, including bare strings that are not docstrings. The rule and option documentation now reflect this behavior.

Test Plan

Added a bare string that is not a docstring to the RUF067 fixture and regenerated the snapshots. The snapshots confirm that strict mode permits module and attribute docstrings while flagging the bare string. The focused RUF067 tests pass. I also verified that a docstring-only __init__.py passes in strict mode.

@astral-sh-bot

astral-sh-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@saberoueslati
saberoueslati marked this pull request as ready for review September 23, 2026 15:58
@astral-sh-bot
astral-sh-bot Bot requested a review from ntBre September 23, 2026 15:58
@ntBre ntBre added rule Implementing or modifying a lint rule preview Related to preview-mode features labels Sep 29, 2026

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks

@ntBre
ntBre merged commit 9c37f03 into astral-sh:main Oct 1, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Related to preview-mode features rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RUF067 allow docstrings in __init__.py in strict mode

2 participants