Skip to content

Preserve source line offsets after leading blank docstring lines - #107

Closed
ShahadatTest wants to merge 1 commit into
peterjc:masterfrom
ShahadatTest:fix/docstring-leading-blank-locations
Closed

ShahadatTest wants to merge 1 commit into
peterjc:masterfrom
ShahadatTest:fix/docstring-leading-blank-locations

Conversation

@ShahadatTest

Copy link
Copy Markdown

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.

@peterjc

peterjc commented Oct 27, 2026

Copy link
Copy Markdown
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.

@peterjc peterjc closed this Oct 27, 2026
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.

2 participants