-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Latest version of ruff (0.4.2) removes blank double blank line that was allowed previously #11254
Comments
Hi! It sounds like this was introduced in our stable style mentioned in the v0.3.0 changelog. You can see more details about the stable style at #8678 However, it looks like this is not a part of Black's stable style e.g. I tested with cc @MichaReiser |
Yeah, I consider this a bug. The two blank lines should be preserved. I checked out v0.2.2 and narrowed it down that this is due to the preview changes in https://github.com/astral-sh/ruff/pull/8283/files. Although I'm not sure what's the cause. |
Hehe, okay, this one is kind of funny, and it's less clear what the intended behavior is. Looking at Black's tests, they are fairly explicit that there should always only be one blank line after a module-level docstring, but that's not what we're seeing in case there's a comment after a module-level docstring. However, that would only mean that there are two bugs:
Note: We should not preserve two blank lines in stub files |
@zanieb @MichaReiser Hello, just checking to see what the status is on this. |
Hi @taranlu-houzz Sorry, I haven't had time to look into this more. |
ruff --version
: 0.4.2I recently updated to the latest version of
ruff
and noticed that in specific cases, a double blank line is now getting changed to a single blank line. I strongly prefer to use double blank lines to visually separate some sections of code, and this only seems to happen in one specific scenario so it is kind of driving me crazy. Here is a code snippet that triggers the change:When this is formatted using
ruff format <file>
(no other flags needed), it remove the blank line above# ==Package==
, but leaves all other double blank lines:In the past, it did not do this. I'm not sure what the previous working version is, but I may try a few previous versions to see if I can narrow it down.
Update: The last version where it didn't delete the blank line was v0.2.2. The next version, v0.3.0 exhibits the new behavior.
The text was updated successfully, but these errors were encountered: