ruff
d387d0ba - RUF022, RUF023: Ensure closing parentheses for multiline sequences are always on their own line (#9793)

Commit
2 years ago
RUF022, RUF023: Ensure closing parentheses for multiline sequences are always on their own line (#9793) ## Summary Currently these rules apply the heuristic that if the original sequence doesn't have a newline in between the final sequence item and the closing parenthesis, the autofix won't add one for you. The feedback from @ThiefMaster, however, was that this was producing slightly unusual formatting -- things like this: ```py __all__ = [ "b", "c", "a", "d"] ``` were being autofixed to this: ```py __all__ = [ "a", "b", "c", "d"] ``` When, if it was _going_ to be exploded anyway, they'd prefer something like this (with the closing parenthesis on its own line, and a trailing comma added): ```py __all__ = [ "a", "b", "c", "d", ] ``` I'm still pretty skeptical that we'll be able to please everybody here with the formatting choices we make; _but_, on the other hand, this _specific_ change is pretty easy to make. ## Test Plan `cargo test`. I also ran the autofixes for RUF022 and RUF023 on CPython to check how they looked; they looked fine to me.
Author
Parents
Loading