Skip to content

Fix pony-lint blank-lines rule false positives on multi-line docstrings#5109

Merged
SeanTAllen merged 1 commit intomainfrom
fix-blank-lines-docstring-counting
Apr 4, 2026
Merged

Fix pony-lint blank-lines rule false positives on multi-line docstrings#5109
SeanTAllen merged 1 commit intomainfrom
fix-blank-lines-docstring-counting

Conversation

@SeanTAllen
Copy link
Copy Markdown
Member

_MaxLineVisitor only checked node.line() for AST nodes, which reports only the start line of string literals. For multi-line docstrings, blank lines inside the docstring body were miscounted as blank lines between members, causing false positives on methods and fields preceded by a member with a multi-paragraph docstring.

The fix uses end_pos() to get the actual end line for multi-line TK_STRING nodes, scoped to strings whose token_value contains a newline — single-line and empty strings skip end_pos() due to a pre-existing parsing bug in that method for short strings.

Also restores multi-paragraph docstrings in pony-lsp that were collapsed in #5098 as a workaround.

Closes #5099

_MaxLineVisitor only checked node.line() for AST nodes, which
reports only the start line of string literals. For multi-line
docstrings, this meant blank lines inside the docstring body were
miscounted as blank lines between members.

The fix uses end_pos() to get the actual end line for multi-line
TK_STRING nodes, scoped to strings whose token_value contains a
newline (single-line and empty strings skip end_pos() due to a
pre-existing parsing bug in that method for short strings).

Also restores multi-paragraph docstrings in pony-lsp that were
collapsed in #5098 as a workaround for this bug.

Closes #5099
@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Apr 4, 2026
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Apr 4, 2026
@SeanTAllen SeanTAllen merged commit eef0596 into main Apr 4, 2026
15 checks passed
@SeanTAllen SeanTAllen deleted the fix-blank-lines-docstring-counting branch April 4, 2026 13:14
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Apr 4, 2026
github-actions bot pushed a commit that referenced this pull request Apr 4, 2026
github-actions bot pushed a commit that referenced this pull request Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pony-lint blank-lines rule counts blank lines inside docstrings

2 participants