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

Clean Trailing Whitespace #2435

Closed
john-science opened this issue Aug 21, 2021 · 5 comments
Closed

Clean Trailing Whitespace #2435

john-science opened this issue Aug 21, 2021 · 5 comments
Labels
S: awaiting response Waiting for futher information from OP S: needs repro Needs a functional reproduction T: bug Something isn't working T: style What do we want Blackened code to look like?

Comments

@john-science
Copy link

Describe the style change

Black does not currently clean trailing whitespace. This is strange, and does not jive well with any major Python linter I can find (say Pylint).

Additional context

The only reason I can think of to not do this now is backwards compatibility.

If ticket isn't immediately closed for being annoying to the dev team, I would happily implement it.

Thanks.

@john-science john-science added the T: style What do we want Blackened code to look like? label Aug 21, 2021
@JelleZijlstra
Copy link
Collaborator

Can you give a specific example? I'm pretty sure we do clean it. The only exception may be within string literals, where changing whitespace could change the meaning of the code.

@ichard26 ichard26 added S: needs repro Needs a functional reproduction T: bug Something isn't working S: awaiting response Waiting for futher information from OP labels Aug 21, 2021
@ghost
Copy link

ghost commented Aug 21, 2021 via email

@john-science
Copy link
Author

Can you give a specific example? I'm pretty sure we do clean it. The only exception may be within string literals, where changing whitespace could change the meaning of the code.

Ah, so that's your reasoning. Okay, well, I guess we can close this.

The problem we have with black is that our docstrings can have trailing whitespace in them that angers pylint, but black refuses to clean it up.

But you're saying that's a design goal? Well, okay then.

Thanks!

@ichard26
Copy link
Collaborator

The problem we have with black is that our docstrings can have trailing whitespace in them that angers pylint, but black refuses to clean it up.

We've had people comment how all whitespace is important in their docstrings because some pattern matching library uses the docstrings as a regex value for example 🙃 [1]

#2150 has some good background discussion on this (plus other stuff).

@onerandomusername
Copy link
Contributor

IMO, I would perfer for docstrings to not be touched-- the ast should be as little affected as possible, if not touched at all.

IF docstrings are touched, it should be a configuration option, perhaps even with a # black: ignore comment function to not clean up specific docstrings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: awaiting response Waiting for futher information from OP S: needs repro Needs a functional reproduction T: bug Something isn't working T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

4 participants