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

Add taploFmt TOML format function to mkLib #674

Merged
merged 5 commits into from
Aug 31, 2024

Conversation

eureka-cpu
Copy link
Contributor

@eureka-cpu eureka-cpu commented Jul 30, 2024

Motivation

Closes #673

Hello, this change adds a function to mkLib for checking formatting of TOML files. TOML files are extremely common, especially among Rust projects, and I find that in all of my use cases of crane between projects I am always manually adding checks for the formatting of Cargo.toml files, and other files such as deny.toml, rust-toolchain.toml, rustfmt.toml and so on.

I have a working copy of this on a local project, otherwise I wasn't sure how to add tests for it. I'm also sure that the copy-pasted code I took from cargoFmt.nix may include some things that don't belong, or may otherwise be going about it the wrong way. Regardless, this is what worked for me, please do instruct me on how to get this to a mergable state, I would greatly appreciate it!

Checklist

  • added tests to verify new behavior (toml format is added to checks so it is already tested in CI)
  • added an example template or updated an existing one
  • updated docs/API.md (or general documentation) with changes
  • updated CHANGELOG.md

Copy link
Owner

@ipetkov ipetkov left a comment

Choose a reason for hiding this comment

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

Hi @eureka-cpu thanks for the PR!

Although I haven't seen the broader Rust community standardize on a toml formatter, this is is pretty self contained so I'm open to including it!

The last thing we need to do before merging this is updating the API docs to document how taploFmt works! You can adapt the existing docs for cargoFmt since they're very similar

lib/taploFmt.nix Show resolved Hide resolved
examples/quick-start-workspace/flake.nix Outdated Show resolved Hide resolved
examples/quick-start/flake.nix Outdated Show resolved Hide resolved
@eureka-cpu
Copy link
Contributor Author

Hi @eureka-cpu thanks for the PR!

Although I haven't seen the broader Rust community standardize on a toml formatter, this is is pretty self contained so I'm open to including it!

The last thing we need to do before merging this is updating the API docs to document how taploFmt works! You can adapt the existing docs for cargoFmt since they're very similar

Thanks for the review! I'll have those changes up shortly (:

Copy link
Owner

@ipetkov ipetkov left a comment

Choose a reason for hiding this comment

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

Thanks again for the contribution!

@ipetkov ipetkov enabled auto-merge (squash) August 31, 2024 17:24
@ipetkov ipetkov merged commit 96fd12c into ipetkov:master Aug 31, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Cargo.toml formatting check to checks
2 participants