You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good question... It doesn't affect the formatter right now, because we never reformat in a way that introduces incompatible syntax. For example, we don't add parentheses around context managers (though we do preserve them if they're already present). It may be necessary when we start to support preview style, since Black does add parentheses around context managers for supported versions when --preview is enabled.
Like in the linter, we don't error if you set --target-python=py38 and already use some syntax that isn't Python 3.8-compatible, because our parser just supports the latest Python syntax. (This may change in the future.) This is different than in Black, where (IIUC) they use the target version to modify the set of supported features in the parser.
(I did some research on this in #7234, if interested.)
All that being said... I think we should add this flag to the formatter, even if it doesn't modulate behavior right now. It's surprising that it doesn't exist, and it will need to exist in the future.
## Summary
This doesn't affect behavior _yet_ (see:
#7234), but it will be needed in
the future, and it's surprising to users that it doesn't exist.
Closes#8051.
Working on migrating our formatter setup to
ruff
. I noticed this does not work:Does the
target-python
setting not affect the formatter? Black has this setting.Related,
ruff format --line-length=100 .
does work, butline-length
isn't listed underruff format --help
.The text was updated successfully, but these errors were encountered: