-
Notifications
You must be signed in to change notification settings - Fork 132
maint: add taplo
pre-commit hook to format and sort toml
files
#3968
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
Conversation
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
Reviewer's GuideAdds a Taplo-based pre-commit hook for automatic TOML formatting and applies it to existing TOML files (e.g., pyproject.toml) to enforce consistent key and array ordering. Sequence Diagram: TOML Formatting with Taplo on CommitsequenceDiagram
actor Developer
participant Git
participant PreCommitFramework as "pre-commit Framework"
participant TaploHook as "taplo-format Hook"
Developer->>Git: git commit
Git->>PreCommitFramework: Trigger hooks for staged files
PreCommitFramework->>TaploHook: Execute on TOML files (with args: reorder_arrays=true, reorder_keys=true)
activate TaploHook
TaploHook->>TaploHook: Load TOML file(s)
TaploHook->>TaploHook: Format content & Sort keys/arrays
TaploHook->>TaploHook: Save modified TOML file(s) if changes were made
TaploHook-->>PreCommitFramework: Report status (e.g., success, files modified)
deactivate TaploHook
PreCommitFramework-->>Git: Aggregated results from all hooks
alt All hooks pass
Git-->>Developer: Commit proceeds (TOML files are formatted)
else Hook failure or files changed requiring user action
Git-->>Developer: Commit aborted / User action required (e.g., re-stage files)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Pull Request Overview
This pull request adds a taplo pre-commit hook to automatically format and reorder TOML files using taplo conventions.
- Introduces a new repository entry for taplo-pre-commit in .pre-commit-config.yaml
- Configures taplo-format with options to reorder arrays and keys
for more information, see https://pre-commit.ci
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.
Hey @tkoyama010 - I've reviewed your changes - here's some feedback:
- Consider adding a dedicated taplo configuration file (e.g., .taplo.toml) to centralize formatting options instead of inlining args in the pre-commit config.
- Specify a
files
pattern in the taplo-format hook (e.g.,files: \.toml$
) to scope formatting explicitly to your project’s TOML files. - Pin the
rev
to an exact commit SHA instead of a version tag for more reproducible hook behavior.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Hi @tkoyama010 !!
Thank you for opening this! :D
Since this PR is coming from a fork, let's migrate it to PyMAPDL repo. @pyansys-ci-bot migrate |
@pyansys-ci-bot migrate |
❌ Error ❌ An error occurred while migrating and syncing the PR. Please check the action logs for more details. |
@pyansys-ci-bot migrate |
🚀 Migration completed! The PR #3971 has been created successfully. |
Description
Please provide a brief description of the changes made in this pull request.
See pyvista/pyvista#6781
Issue linked
Please mention the issue number or describe the problem this pull request addresses.
Checklist
draft
if it is not ready to be reviewed yet.feat: adding new MAPDL command
)Summary by Sourcery
Add a taplo pre-commit hook for automatic formatting and consistent key ordering in TOML files, and apply taplo to reformat and sort entries in pyproject.toml
New Features:
Enhancements:
Summary by Sourcery
Integrate Taplo into the pre-commit workflow to automatically format and sort TOML files.
Enhancements:
CI: