Swap variables with tuple unpacking
ProprietaryDetect the three-line swap idiom (tmp = x; x = y; y = tmp) and condense it into x, y = y, x using tuple unpacking. It only fires inside a function where tmp is mentioned nowhere else, and leaves a swap with comments between its lines alone.
org. openrewrite. python. cleanup. SwapVariablemod run . --recipe= org. openrewrite. python. cleanup. SwapVariableInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.