Repository navigation
Preserve source line offsets after leading blank docstring lines - #107
Closed
ShahadatTest wants to merge 1 commit into
Closed
ShahadatTest wants to merge 1 commit into
ShahadatTest wants to merge 1 commit into
Conversation
Owner
|
Thank you for logging this, the issue sounds real but low priority. I have ethical concerns over AI output, so will not be merging this. I have however opened an issue. |
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.
ast.get_docstring(clean=True) removes leading empty lines. The checker adds RST diagnostic offsets to the original quote line without accounting for those removals, so a warning on line 3 can be reported on line 1. Count the removed leading lines when computing the source offset.
Twelve cases cover module, class, function and async-function docstrings with zero, one or three leading newlines. Eight regressions fail before the source fix, while the four zero-newline controls pass. Existing diagnostic fixtures are also normalized for the platform path separator so the suite can validate these changes on Windows; their diagnostic codes, messages and positions are still compared exactly.
Python 3.12 / flake8 7.4.1 / docutils 0.23 / restructuredtext-lint 2.0.2: full suite 47 passed. Black 26.10, the plugin's own RST check and diff checks pass. Every configured pre-commit hook also passes. Other Python versions/platforms await upstream CI.
Prepared with OpenAI Codex (GPT-6) assistance for
new 10ta koro(make 10 new contributions). No personal production usage or human code review is claimed.