-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Whitespace before fmt: skip
comment is normalised
#4143
Comments
In fact, the For example, black still modifies Is that expected behavior? |
Simplest reproducer:
Despite a line that contains |
I can't reproduce much of what you're reporting. You may be running a different version of Black than you think you're running.
|
Hmm, this is strange. The above output is from Black I have installed by using I have reproduced the issue on the container we have in the repo, which I locally built with the
Similarly, I can do the same on Fedora (a different computer) when installing Black directly from Github:
I am a bit stumped as to what could be the discrepancy here... |
@m-czernek the fix is only in the preview style (although I think technically it would have met the stability policy). That is, your examples are fixed if you use (We're also at the time of year where we cut preview style over to stable, so follow on at #4042 if you're interested) |
@hauntsaninja I'm not sure you understand the issue. The examples seems not to be fixed by using
In other words, the |
Okay, apologies, I was looking too much at #4143 (comment) / mention of #3959 IIUC the only issue remaining in preview is that Black normalises the whitespace before Does that sound right to you? (I've renamed the issue, but will rename again if there's something else as well) |
fmt: skip
is still not respected with other commentsfmt: skip
comment is normalised
See also #2970 (review) |
Describe the bug
Apologies if this is a duplicate; I have read:
# fmt: skip
in the presence of other comments/pragmas #3330Based on #3959, Black should support e.g. this:
# pylint: disable=redefined-outer-name # fmt: skip
and yet I cannot get it to work on the newest Black version.I have the following line:
The line is too long for black, so when I run black, I get this:
We don't want that, so I tried to use
fmt: skip
. I tried the following comments:client = billingdataservice.app.test_client() # pylint: disable=redefined-outer-name; fmt: skip
client = billingdataservice.app.test_client() # pylint: disable=redefined-outer-name # fmt: skip
client = billingdataservice.app.test_client() # fmt: skip # pylint: disable=redefined-outer-name
client = billingdataservice.app.test_client() # fmt: skip; pylint: disable=redefined-outer-name
as well as mixing number of spaces before/after the hash sign, e.g.
...test_client() # fmt: skip; pylint: ...
or...test_client() # fmt: skip; pylint: ...
etc.Reproducer
file.py
:Command:
(The
--preview
flag seems not to matter for this issue; behavior is identical with or without it)Black always modifies the line, e.g.:
Which means
fmt: skip
did not get honored.Environment
The text was updated successfully, but these errors were encountered: