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

[WIP RFC] Enforce rustfmt on automation. #20617

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -103,6 +103,7 @@ linux-dev:
CCACHE: sccache
RUSTC_WRAPPER: sccache
commands:
- ./etc/ci/check_rustfmt.sh
- ./mach clean-nightlies --keep 3 --force
- ./mach clean-cargo-cache --keep 3 --force
- ./etc/ci/clean_build_artifacts.sh
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

set -o errexit
set -o nounset
set -o pipefail

cd "$(git rev-parse --show-toplevel)"

# NOTE(emilio): This assumes that HEAD is a merge commit, which is true for
# builbot stuff. Locally you probably want to use `-1`.
LAST_MERGE="$(git log --merges --format=%h -2 | tail -1)"

cargo install --force rustfmt-nightly
git diff ${LAST_MERGE} | rustfmt-format-diff -p 1

git add -u
git diff @
git diff-index --quiet HEAD
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.