Skip to content

fix(comments): treat # ruff: comments as pragmas in contains_pragma_comment - #5266

Open
amir-rezaei wants to merge 1 commit into
psf:mainfrom
amir-rezaei:fix/contains-pragma-comment-ruff-directives
Open

fix(comments): treat # ruff: comments as pragmas in contains_pragma_comment#5266
amir-rezaei wants to merge 1 commit into
psf:mainfrom
amir-rezaei:fix/contains-pragma-comment-ruff-directives

Conversation

@amir-rezaei

@amir-rezaei amir-rezaei commented Jul 28, 2026

Copy link
Copy Markdown

Description

This PR resolves issue #5260 by adding # ruff: to the pragma prefixes in contains_pragma_comment() in src/black/comments.py.
Closes #5261, fixes #5260

Details

  • Ensures # ruff:ignore and # ruff:noqa comments are treated as pragmas, preventing unnecessary line splits when comments follow long lines.

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.

ruff:ignore should be processed as a pragma in contains_pragma_comment

2 participants