hhatto / autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.
https://pypi.org/project/autopep8/
MIT License
4.54k stars 291 forks source link

Using "--ignore=E302" and "--ignore=E305" at the same time #695

Closed ppzoglou closed 9 months ago

ppzoglou commented 11 months ago

I initially opened an issue on vscode's autopep8 extension repo but as I understand it, there is not much they can do about it so I came here. My desired outcome is for there not to be any extra (more than one) blank lines between defs, classes and the rest of the code, neither above nor bellow them. It seems like I can only achieve one of the two at any time based on what I choose to ignore last.

example

As you can see in this image, at first there are no extra blank lines. Then I format the file using ignore=E305 last resulting in there only being one extra blank line added between the function and the first print statement. After that I format it again this time with ignore=E302 being the last arg and as you can see its the exact opposite result this time, with the extra blank line being added under the function.

Environment

hhatto commented 9 months ago

@ppzoglou If you want to specify more than one, separate them by commas. For example: --ignore=E121,E302,E305