about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-09-28 09:15:30 +0200
committerGitHub <noreply@github.com>2025-09-28 09:15:30 +0200
commitf31963ff825a77f650aa815528f43b9dc968ad2f (patch)
treee7a86c65590a01a31239b86f8e62bdd7257623e3 /src
parent641bedabb1834b47d6e3380b437d889ac3ecd458 (diff)
parentaef976ed4c73dab044002b39817509110ddf2cf2 (diff)
downloadrust-f31963ff825a77f650aa815528f43b9dc968ad2f.tar.gz
rust-f31963ff825a77f650aa815528f43b9dc968ad2f.zip
Rollup merge of #147098 - Shunpoco:issue-147088, r=Kobzol
Add auto extra-checks in pre-push hook

Fixes rust-lang/rust#147088

This PR adds auto py, cpp, and js extra checks into the pre-push script.
- It checks those non-Rust files only if they are modified in the commit
- Thanks to auto mode, the pre-push doesn't check them if none of them are modified. It means that it doesn't build venv, nor install node_packages under build/

Note that this PR doesn't add shellcheck and spellcheck, because
- Currently shellcheck isn't installed by the tidy command unlike venv/node_modules. So it forces developers to take a extra task to enable pre-push hook
- Spellcheck is built whenever I kick test tidy with the option. If I enables it, developers should wait extra time for running pre-push hook
Diffstat (limited to 'src')
-rwxr-xr-xsrc/etc/pre-push.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/etc/pre-push.sh b/src/etc/pre-push.sh
index 7bacc943f25..33ed2f0e406 100755
--- a/src/etc/pre-push.sh
+++ b/src/etc/pre-push.sh
@@ -26,7 +26,10 @@ ROOT_DIR="$(git rev-parse --show-toplevel)"
 echo "Running pre-push script $ROOT_DIR/x test tidy"
 
 cd "$ROOT_DIR"
-./x test tidy --set build.locked-deps=true
+# The env var is necessary for printing diffs in py (fmt/lint) and cpp.
+TIDY_PRINT_DIFF=1 ./x test tidy \
+    --set build.locked-deps=true \
+    --extra-checks auto:py,auto:cpp,auto:js
 if [ $? -ne 0 ]; then
     echo "You may use \`git push --no-verify\` to skip this check."
     exit 1