Fix --add-noqa whitespace on blank lines#23839
Closed
Bortlesboat wants to merge 1 commit intoastral-sh:mainfrom
Closed
Fix --add-noqa whitespace on blank lines#23839Bortlesboat wants to merge 1 commit intoastral-sh:mainfrom
--add-noqa whitespace on blank lines#23839Bortlesboat wants to merge 1 commit intoastral-sh:mainfrom
Conversation
When `--add-noqa` adds a directive to a blank line (e.g., for D100
diagnostics at TextRange::ZERO), it previously inserted leading
whitespace (" # noqa: ..."). Now it omits the leading spaces for
blank lines, producing "# noqa: ..." instead.
Fixes #23751
Member
|
Thank you. Unfortunately, there's already a PR for this, see #23773 |
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.
Summary
Fixes #23751
When
--add-noqaadds a noqa directive to a blank line (e.g., forD100diagnostics that targetTextRange::ZERO), it previously inserted leading whitespace (# noqa: D100). This change skips the two leading spaces when the line has no content, producing# noqa: D100instead.Test plan
blank_line_no_leading_whitespacethat verifies a diagnostic on a blank line produces# noqa: F841\nwithout leading spaces.