Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.

Conversation

@flying-sheep
Copy link
Contributor

@flying-sheep flying-sheep commented Jul 31, 2024

Fixes #42

before this fix

  • 👍 arrays that we don’t sort behave as expected (i.e. only get expanded when longer than column_width), but
  • 👎 arrays that we do sort are always expanded into multiple lines
  • 👍 arrays are never collapsed, which helps with VCS diffs

after this change

  • 👍 single-line arrays are expanded when their lines are longer than column_width
  • 👍 arrays are still never collapsed

Tip

One great thing about this change is that it doesn’t affect formatting at all for people who already use pyproject-fmt. It only affects people who newly adopt it or newly manually added/collapsed arrays


I also added pretty-assertions to the dev dependencies, because I think everyone agrees that trying to interpret

thread 'tests::test_column_width' panicked at rust/src/main.rs:335:9:
assertion `left == right` failed
  left: "[build-system]\nbuild-backend = \"backend\"\nrequires = [ \"c>=1.5\", \"d==2\" ]\n\n[project]\nname = \"beta\"\nclassifiers = [ \"Programming Language :: Python :: 3 :: Only\", \"Programming Language :: Python :: 3.12\" ]\ndependencies = [\n    \"e>=1.5\",\n]\n"
 right: "[build-system]\nbuild-backend = \"backend\"\nrequires = [ \"c>=1.5\", \"d==2\" ]\n\n[project]\nname = \"beta\"\nclassifiers = [\n    \"Programming Language :: Python :: 3 :: Only\",\n    \"Programming Language :: Python :: 3.12\",\n]\ndependencies = [\n    \"e>=1.5\",\n]\n"

is much worse than seeing

grafik

@flying-sheep flying-sheep changed the title Fix arrays being exploded without reason Fix arrays being expanded without reason Jul 31, 2024
@gaborbernat gaborbernat marked this pull request as draft July 31, 2024 14:50
@flying-sheep flying-sheep requested a review from gaborbernat July 31, 2024 18:02
@flying-sheep flying-sheep marked this pull request as ready for review July 31, 2024 18:14
@gaborbernat gaborbernat merged commit 55f2813 into tox-dev:main Jul 31, 2024
@flying-sheep flying-sheep deleted the fix-newlines branch July 31, 2024 20:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

column_width is not respected everywhere

2 participants