-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
ruff --version
: 0.4.2
I 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:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Run CLI if package is run directly as a module."""
####################################################################################################
# Imports
####################################################################################################
# ==Package==
from ._private import cli_test_utils
####################################################################################################
# Main
####################################################################################################
cli_test_utils.run_app()
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:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Run CLI if package is run directly as a module."""
####################################################################################################
# Imports
####################################################################################################
# ==Package==
from ._private import cli_test_utils
####################################################################################################
# Main
####################################################################################################
cli_test_utils.run_app()
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.