Skip to content

docs(taplo): add toml formatter #1456

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bearomorphism
Copy link
Contributor

@bearomorphism bearomorphism commented May 25, 2025

Description

I noticed that I accidentally introduced unexpected style change in pyproject.toml (50fd65f), so I think it would be better if we have a consistent toml formatter.

Checklist

Code Changes

  • Update the documentation for the changes

Expected Behavior

Pre-commit hook now has taplo and it should work even without installing taplo locally.

Steps to Test This Pull Request

  1. Randomly insert white spaces in pyproject.toml and save without formatting to make the formatting bad.
  2. git commit
  3. The broken format should be fixed.

Additional Context

https://taplo.tamasfe.dev/configuration/formatter-options.html

Copy link

codecov bot commented May 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.62%. Comparing base (120d514) to head (2d56a80).
Report is 626 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1456      +/-   ##
==========================================
+ Coverage   97.33%   97.62%   +0.28%     
==========================================
  Files          42       57      +15     
  Lines        2104     2653     +549     
==========================================
+ Hits         2048     2590     +542     
- Misses         56       63       +7     
Flag Coverage Δ
unittests 97.62% <ø> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bearomorphism bearomorphism marked this pull request as ready for review May 25, 2025 12:34
"cover",
"check-commit",
]
all.sequence = ["format", "lint", "cover", "check-commit"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean this one? But it seems to be a one-liner still

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find a good combination of options to keep the file unchanged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I set array_auto_collapse = false then someone with their formatter can still make it a one-liner.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I set column_width = n for some n < 80 then taplo introduces more changes.

@bearomorphism bearomorphism force-pushed the toml-formatter branch 2 times, most recently from 2f37245 to 261a106 Compare May 25, 2025 14:00
Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with this one, but I will let @woile or @noirbizarre decide whether we need it.

@Lee-W Lee-W added pr-status: ready-to-merge almost ready to merge. just keep it for a few days for others to check and removed pr-status: wait-for-review labels May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: ready-to-merge almost ready to merge. just keep it for a few days for others to check type: documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants