-
Notifications
You must be signed in to change notification settings - Fork 11
Configurable collapse #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
flying-sheep
wants to merge
4
commits into
tox-dev:main
Choose a base branch
from
flying-sheep:pa/skip-collapse
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I am on board with selective collapse I think I said in the issue too I would really prefer this to be on or off like rather than selective...
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I didn’t interpret the line
as you meant it. Can you please describe what you meant by that?
what’s a “short or long value”?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not want configurable collapse. It should be either collapse all or expand all 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t understand what you mean! Expand/collapse can happen on multiple levels and neither “collapsing all” nor “expanding all” makes sense, as nobody would want that.
Currently, pyproject-fmt has an algorithm determining which collapsed table headers exist:
[project]
[build-system]
[tool.*]
Everything below these gets expanded.
“expanding all” means to me that there are no table headers, and
project.name = "..."
exists together withtool.ruff.lint.… = ...
. Nobody wants that.“collapsing all” could mean that only table headers can contain dots, like the many many
[ruff.lint.…]
headers here:toml-fmt/pyproject-fmt/rust/src/data/ruff-order.start.toml
Lines 58 to 67 in 2473f90
Nobody wants that either.
Everyone using
pyproject-fmt
likes expanding things, except for a handful of super long collapsed tables, like described in #5 and #35There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore level 1. The project today collapses all supported table configurations of level 2+ into level 2. This is what I call collapse all.
Expand all would be to expand all configurations to be tables.
Interesting idea, though I'm not sure how you surveyed everyone. I think this is a personal stylistic choice, and this is an opinionated formatter after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tool.ruff.lint.flake8-tidy-imports.banned-api."some.import".msg
is just ridiculous, but that doesn’t mean I want to see dozens of table headers with a single entry each.Can we find a rule that respects that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a personal opinion but I don't find it that bad. 🤔
That being said I'm not totally opposed to this idea, but I'm also not invested in making it happen, as I find the status quo alright. If someone puts together a well tested PR I'll review, but I'll not invest time in trying to make it happen.
PS. Your tone is a bit aggressive here, I'd recommend stop throwing around harsh words like
everyone
,nobody
orridiculous
; and choose some that respect the fact that we all have different tastes and opinions, and that's alright.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m German, I tend to be a bit more direct than what Americans are accustomed to, and quite thankful when it’s pointed out that something could be perceived as harsh.
However, that requires the other side to assume the same humility. My tone isn’t aggressive, you perceive it as such. I’m not thankful for tone-policing that portrays such subjective matters as a fact.
Yeah, I think we’d need to come up with a rule/preset that makes sense. I totally get it that you don’t want total customizability.
To elaborate on my motivation for the current approach: I was thinking that the 1–2 levels you’re referring to above are not a numerical cutoff but semantic: we know there’s only
build-system
(1 level),project
(1 level) andtool.*
(2 levels). But we don’t know every single tool’s layering. That’s why I thought that hard-coding would be too much maintenance effort, and I can think of no heuristic that makes sense, and therefore opted for customizability.So how would a rule look like that you could get behind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we’re not making progress here, so I’ll take a step back from this conversation for now.