Skip to content
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

Tables ordering issues #3

Open
funkyfuture opened this issue Sep 23, 2024 · 0 comments
Open

Tables ordering issues #3

funkyfuture opened this issue Sep 23, 2024 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@funkyfuture
Copy link

funkyfuture commented Sep 23, 2024

when i pass a file with these tables into pyproject-fmt (2.2.4):

[tool.flake8]

[tool.cff-from-621]
[tool.cff-from-621.static]

[tool.coverage.run]
[tool.coverage.report]

[tool.hatch.envs.linting]
[tool.hatch.envs.linting.scripts]

[tool.hatch.envs.unit-tests]
[tool.hatch.envs.unit-tests.scripts]

[tool.hatch.envs.mypy]
[tool.hatch.envs.mypy.scripts]

these get reordered to:

[tool.hatch.envs.linting]
[tool.hatch.envs.linting.scripts]

[tool.hatch.envs.unit-tests]
[tool.hatch.envs.unit-tests.scripts]

[tool.hatch.envs.mypy]
[tool.hatch.envs.mypy.scripts]

[tool.flake8]

[tool.coverage.run]
[tool.coverage.report]

[tool.cff-from-621]
[tool.cff-from-621.static]

it seems that the tables get sorted in reverse alphabetical order on their second level and further levels aren't considered for sorting at all.

in the somewhat similar tox-dev/pyproject-fmt#241 a certain "philosophy" is mentioned and the docs describe its aim as "consistency, predictability", nothing more specific to the ordering of tables. however neither would i consider reverse sorting as a commonly predicted result, nor is the different ordering depending on the table-level consistent. if those behaviours are intended, they should be spelled out in the docs.

as reference, this would be an outcome that i would consider consistent:

[tool.cff-from-621]
[tool.cff-from-621.static]

[tool.coverage.run]
[tool.coverage.report]

[tool.flake8]

[tool.hatch.envs.linting]
[tool.hatch.envs.linting.scripts]

[tool.hatch.envs.mypy]
[tool.hatch.envs.mypy.scripts]

[tool.hatch.envs.unit-tests]
[tool.hatch.envs.unit-tests.scripts]
@gaborbernat gaborbernat transferred this issue from tox-dev/pyproject-fmt Oct 17, 2024
@gaborbernat gaborbernat added help wanted Extra attention is needed bug Something isn't working labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants