Isort: Remove leading newlines.

Created on 22 May 2018  路  2Comments  路  Source: PyCQA/isort

Would be nice if isort could automatically remove any leading newlines at the top of the file, or at least offer a configuration option to do so.

I've had cases where blank lines have been left behind as a result of global search&replacing, or just someone lazily throws their import in at the top of the file, tapping enter a few times in the process, and expecting isort to clean up their mess on file save.

Currently isort does nothing with leading newlines and is happy to have a whole block of whitespace before imports start.

Related to #630

wont_fix

All 2 comments

After careful consideration, I've decided this is outside of the scope of what I can support isort doing at this time. While I agree the feature would be useful, In order to support isort over the long-term I need to focus on pure import sorting functionality, relying on other tools to do anything outside the scope of imports. However, isort could improve it's handling of lines directly above imports, and I would accept an issue in this form.

Thanks!

~Timothy

Is there a workaround to make an empty line between shebang and the first import statement?

Was this page helpful?
0 / 5 - 0 ratings