villebro opened a new pull request, #2179:
URL: https://github.com/apache/datafusion-ballista/pull/2179

   ## Background
   
   The `Check Cargo.toml formatting` CI job does not currently fail on 
formatting violations, for two reasons:
   
   - `ci/scripts/rust_toml_fmt.sh` runs `cargo tomlfmt -k -p` via `find … 
-exec`. `find` does not propagate the tool's non-zero exit code, so `set -e` is 
not triggered.
   - The workflow's failure guard checks for a `Cargo.toml.bak` file, but 
`cargo-tomlfmt` 0.2.1 writes `Cargo.toml.new` rather than `.bak`, so the guard 
does not match.
   
   As a result the job passes regardless of manifest formatting, and the 
manifests have drifted from a consistent style. Separately, `cargo-tomlfmt` 
0.2.1 has some limitations for this use case: it writes a `.new` file rather 
than formatting in place, and it does not preserve comments when reformatting 
(see 
[tbrand/cargo-tomlfmt#40](https://github.com/tbrand/cargo-tomlfmt/issues/40)).
   
   ## Change
   
   Move Cargo.toml formatting to **taplo**, aligning with the parent 
[apache/datafusion](https://github.com/apache/datafusion) project:
   
   - Add `taplo.toml` (copied from apache/datafusion) — Cargo.toml-only scope, 
4-space indent to match the existing style, `reorder_keys = false` for 
`[package]` (preserves key order and comments), alphabetized dependency tables.
   - Rewrite `ci/scripts/rust_toml_fmt.sh` to run `taplo format --check` (with 
a `--write` mode to fix in place). This returns a non-zero exit code on 
violations, so the check enforces formatting, and it leaves no scratch files.
   - `.github/workflows/rust.yml`: install `[email protected]` via 
`taiki-e/install-action` and remove the `.bak` guard, which is no longer needed.
   - `dev/rust_lint.sh`: install `taplo` instead of `cargo-tomlfmt`.
   - Reformat the manifests to satisfy the check (dependency reordering and 
array expansion; comments preserved).
   
   ## Consistency with apache/datafusion
   
   The parent project uses the same setup:
   
   | | apache/datafusion | this PR |
   |---|---|---|
   | Install | `[email protected]` via `taiki-e/install-action` | same |
   | Check command | `taplo format --check` | same (via `rust_toml_fmt.sh`) |
   | Rules | root `taplo.toml` | verbatim copy |
   
   ## Verification
   
   - `ci/scripts/rust_toml_fmt.sh` (check) exits `0` on the formatted tree.
   - Introducing a formatting violation in a manifest causes the check to exit 
non-zero (verified locally).
   - No `Cargo.toml.new` / `.bak` scratch files are left behind.
   - `ci/scripts/rust_toml_fmt.sh --write` reformats in place.
   - No comment lines were removed by the reformat.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to