Skip to content

CI: check the formatting with cargo fmt on all PRs - #17

Closed
raffclar wants to merge 1 commit into
Marvisak:mainfrom
raffclar:ci-fmt
Closed

raffclar wants to merge 1 commit into
Marvisak:mainfrom
raffclar:ci-fmt

Conversation

@raffclar

Copy link
Copy Markdown
Contributor

Enforce common standard for code styling

A new workflow runs `cargo fmt --all -- --check` on each push to main
and on each pull request. It uses the toolchain that
rust-toolchain.toml gives and rustfmt.toml, so it agrees with a local
`cargo fmt`. It runs on Linux, because rustfmt does not compile code.

The tree is not formatted yet (26 files), so the check fails until a
`cargo fmt --all` commit is merged.
@PolpOnline

Copy link
Copy Markdown

@raffclar Should also enforce tests on CI (at least those not depending on the binary being present)

@raffclar

Copy link
Copy Markdown
Contributor Author

Yeah I agree. I'm trying to do things in small chunks for easier review

@DaviTostes

Copy link
Copy Markdown

Checked the gate this workflow adds, at main 97c78d1 with the pinned toolchain (rustfmt 1.98.1): the tree is not formatted yet, so the check fails before any PR is looked at.

  • cargo fmt --all -- --check: 141 hunks in 28 files, e.g. crates/victory-formats/src/texture.rs (10), xma.rs (9), xma/tables.rs (16), victory-gpu/src/host.rs (15), victory-hle/src/modules/xgamesave.rs (13), victory-loader/src/crash.rs (7).
  • With Build: make workspace tests run on Linux #39 stacked the same 141 hunks appear (that PR does not touch formatting).
  • So as written the workflow is red for every PR until the tree is formatted once; either cargo fmt --all should be part of this PR (before the gate is enabled) or the check should compare only the files a PR changes. Also worth pinning the rustfmt version to the rust-toolchain.toml one explicitly, since formatting differs between releases.

No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).

@Quat3rnion

Copy link
Copy Markdown
Contributor

The format gate here is red on current main: the tree has about 141 formatting hunks across 28 files. #112 formats the tree once and adds a Linux CI job that runs the format check, workspace tests and asset policy. Please consider closing this in favour of #112. Thanks for starting the CI work, @raffclar.

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.

4 participants