Magic Trailing Commas in isort#1363
Magic Trailing Commas in isort#1363charliermarsh merged 37 commits intoastral-sh:mainfrom colin99d:1200
Conversation
|
Awesome, thank you for this! Will try to review today. |
|
In isort this is configurable with the |
|
Agreed. |
|
I haven't tested but... Awesome! |
|
@charliermarsh it looks like this has some weird behavior when importing with as, even if the feature is disabled. I am not sure why. But I will dig in. |
|
|
||
| See isort's [`split-on-trailing-comma`](https://pycqa.github.io/isort/docs/configuration/options.html#split-on-trailing-comma) option. | ||
|
|
||
| **Default value**: `true` |
There was a problem hiding this comment.
I also made this the default, to match isort's profile = "black".
| trailing_comma(import, locator) | ||
| } else { | ||
| TrailingComma::default() | ||
| }, |
There was a problem hiding this comment.
I also tweaked the order of operations: instead of collecting locations, and looking at the locations at the end, we detect a trailing comma for each block, and then propagate it through the code as we merge imports.
|
Thank you! Appreciate all the effort and output here :) I made a few changes (which I think fixed the |
|
I love all of them, thanks for the help!! |
|
@colin99d - Thank you! Grateful for the contribution! |
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://togithub.com/charliermarsh/ruff) | `^0.0.194` -> `^0.0.195` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>charliermarsh/ruff</summary> ### [`v0.0.195`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.195) [Compare Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.194...v0.0.195) #### What's Changed - Add support for `ruff.toml` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1378](https://togithub.com/charliermarsh/ruff/pull/1378) - Update rust python to handle files with BOM by [@​squiddy](https://togithub.com/squiddy) in [https://github.com/charliermarsh/ruff/pull/1379](https://togithub.com/charliermarsh/ruff/pull/1379) - Only re-associate inline comments during normalization when necessary by [@​squiddy](https://togithub.com/squiddy) in [https://github.com/charliermarsh/ruff/pull/1380](https://togithub.com/charliermarsh/ruff/pull/1380) - Magic Trailing Commas in isort by [@​colin99d](https://togithub.com/colin99d) in [https://github.com/charliermarsh/ruff/pull/1363](https://togithub.com/charliermarsh/ruff/pull/1363) - Web playground with WASM by [@​squiddy](https://togithub.com/squiddy) in [https://github.com/charliermarsh/ruff/pull/1279](https://togithub.com/charliermarsh/ruff/pull/1279) - Enable preview deployments for playground by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1383](https://togithub.com/charliermarsh/ruff/pull/1383) - Add ESLint, Prettier, and TypeScript checks by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1384](https://togithub.com/charliermarsh/ruff/pull/1384) - Add badge to playground by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1393](https://togithub.com/charliermarsh/ruff/pull/1393) - Choose a more interesting example snippet by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1394](https://togithub.com/charliermarsh/ruff/pull/1394) - Enable Quick Fix in the playground by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1395](https://togithub.com/charliermarsh/ruff/pull/1395) - Only run playground release in main repo by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1396](https://togithub.com/charliermarsh/ruff/pull/1396) - Now replace typing.Text with str by [@​colin99d](https://togithub.com/colin99d) in [https://github.com/charliermarsh/ruff/pull/1391](https://togithub.com/charliermarsh/ruff/pull/1391) **Full Changelog**: astral-sh/ruff@v0.0.194...v0.0.195 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC43My4zIiwidXBkYXRlZEluVmVyIjoiMzQuNzMuMyJ9--> Signed-off-by: Renovate Bot <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This fixes #1200 by adding magic trailing comma support. Looking forward to your feedback!