microsoft/vscode-autopep8

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

ppzoglou opened this issue · 5 comments

I tried using those two args in order to remove the extra blank line before and after a funtion decleration, however this doesn't seem to work as intented. To be more specific, it seems like only the one you added last takes effect.

@nickpap35gr Can you share the logs for this please? Logs should be available under Output > autopep8.

@nickpap35gr Can you share the logs for this please? Logs should be available under Output > autopep8.

These are the logs I get after saving a file with: a comment -> 1 blank line -> a function -> 1 blank line -> another comment. Since "-ignore=E305 " came last, the blank line between the function and the second comment stays as is, but there is an aditional blank line added between the first comment and the function. If I were to put "--ignore=E302" last in the args list, the exact opposite event would take place.

2023-08-02 23:47:04.561 [info] [Trace - 11:47:04 PM] Sending request 'textDocument/formatting - (6)'.
2023-08-02 23:47:04.563 [info] [Trace - 11:47:04 PM] Received notification 'window/logMessage'.
2023-08-02 23:47:04.563 [info] /bin/python3 -m autopep8 --indent-size=2 --ignore=E121 --ignore=E302 --ignore=E305 -
2023-08-02 23:47:04.563 [info] [Trace - 11:47:04 PM] Received notification 'window/logMessage'.
2023-08-02 23:47:04.563 [info] CWD Server: /home/nikos/Desktop/Python
2023-08-02 23:47:04.625 [info] [Trace - 11:47:04 PM] Received response 'textDocument/formatting - (6)' in 64ms.
2023-08-02 23:47:04.628 [info] [Trace - 11:47:04 PM] Sending notification 'textDocument/didChange'.

Looking at the logs this seems like a bug in autopep8 when using the stdin mode. You should be able to repro this by using path to your file:

cat <your-file> | /bin/python3 -m autopep8 --indent-size=2 --ignore=E121 --ignore=E302 --ignore=E305 -

Indeed I get the same result when running this command

Closing this issue as it seems to be a bug with autopep8 itself