Implement pylint's empty-comment rule (PLR2044)
#5900
Draft
+184
−0
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.
Implement empty-comment
https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/empty-comment.html
Issue #970
This PR is still draft as locally running
cargo dev generate-alladd the newPLR2044rule, but also removesRUF014which does not seem expected.Also note, I've written some small programs in Rust but don't call myself experienced :)
Last note, the
--fixwill leave trailing spaces, but I guess that's fine as it might be tricky to determine what more to remove? Or should the code be a bit smarter andrtrim()after dropping the trailing#?Summary
Implement pylint's
empty-commentrule.Pylint implementation https://github.com/pylint-dev/pylint/blob/c4281bcff86b66fdf8518e7f57dc3405c8da3a4f/pylint/extensions/empty_comment.py#L43
Test Plan
Manually and by running the unit test from https://github.com/pylint-dev/pylint/blob/c4281bcff86b66fdf8518e7f57dc3405c8da3a4f/tests/functional/ext/empty_comment/empty_comment.py#L4