Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Auto rustfmt commit action? #8

Open
repi opened this issue Sep 27, 2019 · 2 comments
Open

Auto rustfmt commit action? #8

repi opened this issue Sep 27, 2019 · 2 comments

Comments

@repi
Copy link

repi commented Sep 27, 2019

On all of our repos we have a CI check that ensures rustfmt has been run and fails the build if it has not, and we are experimenting with changing to use the actions-rs action for just that instead of Travis & Buildkite.

But one thing we've thought about (cc @Jake-Shadle) that may be even better alternative workflow would be a rustfmt action that instead of warning or failing a PR on fmt differences actually just runs cargo fmt and commits & pushes changed files to the PR branch.

How hard would it be to create such an action?

Probably is not the best workflow for everyone, but we typically squash our commits so some occasional "Rustfmt" commits is fine, and nice to not have to do manually and push up on a broken build.

This is mostly a problem because RLS doesn't work in our large projects (EmbarkStudios/rust-ecosystem#8) which makes rustfmt not automatically run in VS Code so formatting on save often doesn't work so code slips in without correct formatting.

@raftario
Copy link

I could also use this, gonna start working on it!

@svartalf You can mention me when/if you want me to transfer ownership.

@CAD97
Copy link

CAD97 commented Oct 9, 2019

I had a different idea: add a rustfmt-check like clippy-check. Since GitHub now (beta) supports multiline diff comments as well as suggestions, the output of cargo clippy -- --check can be parsed and turned into suggestions directly on the PR.

(Of course, this is assuming GitHub decides to give the token used for running PRs from forks write permissions to the PR comments to be of any real use.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants