Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement W291 (trailing whitespace)? #1734

Closed
harupy opened this issue Jan 8, 2023 · 7 comments
Closed

Implement W291 (trailing whitespace)? #1734

harupy opened this issue Jan 8, 2023 · 7 comments

Comments

@harupy
Copy link
Contributor

harupy commented Jan 8, 2023

It'd be nice if Ruff could detect trailing whitespace:

image

(even though black can eliminate them)

@harupy harupy changed the title Implement W291? Implement W291 (trailing whitespace)? Jan 8, 2023
@charliermarsh
Copy link
Member

I don't know if it's relevant (haven't thought through how we would implement trailing whitespace), but I started implementing Pycodestyle's logical line detection in #1130 -- although I felt at the time that it was a bit too slow to be worthwhile as a default.

@charliermarsh
Copy link
Member

Do these checks typically exclude trailing whitespace within strings?

@not-my-profile
Copy link
Contributor

Black preserves trailing whitespace in multiline strings (as it should). I just checked and pycodestyle does trigger W291 for trailing whitespace within multiline strings. To be honest I don't really see the point of this lint.

@charliermarsh
Copy link
Member

I think it's a perfectly useful rule, if you don't use an autoformatter.

@not-my-profile
Copy link
Contributor

Haha yes I don't see why you wouldn't.^^

@harupy
Copy link
Contributor Author

harupy commented Jan 8, 2023

@charliermarsh @not-my-profile Agreed! Let me close this.

@harupy harupy closed this as completed Jan 8, 2023
@harupy
Copy link
Contributor Author

harupy commented Jan 8, 2023

Black preserves trailing whitespace in multiline strings (as it should). I just checked and pycodestyle does trigger W291 for trailing whitespace within multiline strings. To be honest I don't really see the point of this lint.

Yes, black does. We can align with black and ignore trailing whitespace in strings (as shown in the attached screenshot).

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

No branches or pull requests

3 participants