Automatically add newline on save in PyCharm?

Viewed 20417

PyCharm 5 complains of a missing newline at the end of the file:

PEP 8: No newline at end of file

How do I tell PyCharm to add the newline (if missing) automatically whenever I save a file?

6 Answers

PyCharm 2021.1

You can now find this setting here:

Settings > Editor > General > Ensure every saved file ends with a line break.

This should be a default feature but if it is not enabled:

go to settings > Editor > General

then you will see a checkbox option to select...

Related