mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:15:12 +00:00
![]() ## Summary Right now, in the isort comment model, there's nowhere for trailing comments on the _statement_ to go, as in: ```python from mylib import ( MyClient, MyMgmtClient, ) # some comment ``` If the comment is on the _alias_, we do preserve it, because we attach it to the alias, as in: ```python from mylib import ( MyClient, MyMgmtClient, # some comment ) ``` Similarly, if the comment is trailing on an import statement (non-`from`), we again attach it to the alias, because it can't be parenthesized, as in: ```python import foo # some comment ``` This PR adds logic to track and preserve those trailing comments. We also no longer drop several other comments, like: ```python from mylib import ( # some comment MyClient ) ``` Closes https://github.com/astral-sh/ruff/issues/12487. |
||
---|---|---|
.. | ||
resources | ||
src | ||
__init__.py | ||
Cargo.toml |