yapf icon indicating copy to clipboard operation
yapf copied to clipboard

Fix fallback behavior on invalid/empty line ranges.

Open msuozzo opened this issue 3 years ago • 2 comments

The existing logic behaves poorly when the output of _LineRangesToSet is empty (note: not None, an empty set). Instead of restricting formatting to the empty set of lines (i.e. suppressing all formats), the current behavior lifts all line constraints and formats the whole file. It's perhaps not a bug but I think it's surprising behavior and the improper response to unexpected input.

msuozzo avatar Aug 24 '22 19:08 msuozzo

Do you have a testcase for this?

bwendling avatar Aug 24 '22 19:08 bwendling

Done

msuozzo avatar Aug 24 '22 19:08 msuozzo

Done

Where?

thiagowfx avatar Feb 13 '23 19:02 thiagowfx

This technically should never happen because _LineRangesToSet returns a non-null set if and only if there are line ranges specified.

bwendling avatar Jun 22 '23 06:06 bwendling

Done

Where?

oops! it never got pushed.

Regardless, I'm fine abandoning this given it's no longer relevant for our use-case.

msuozzo avatar Aug 10 '23 22:08 msuozzo