From 5a25acb8dce3e82b7e9675e3547ed7ba8b9620af Mon Sep 17 00:00:00 2001 From: BrewingWeasel Date: Fri, 17 Nov 2023 17:26:21 -0500 Subject: [PATCH] rusty-hook: only run the checks needed for the files modified --- .rusty-hook.toml | 2 +- justfile | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.rusty-hook.toml b/.rusty-hook.toml index d23cfe1..5a28166 100644 --- a/.rusty-hook.toml +++ b/.rusty-hook.toml @@ -1,5 +1,5 @@ [hooks] -pre-commit = "just check" +pre-commit = "just pre-commit" post-commit = "echo commited!" [logging] diff --git a/justfile b/justfile index 847ab23..fa79388 100644 --- a/justfile +++ b/justfile @@ -9,7 +9,7 @@ lint: format: leptosfmt ./src-ui/src cargo fmt - @# TODO: some sort of css formatting (prettier?) +# TODO: some sort of css formatting (prettier?) # Fix code not passing pre-commit hook (uses --allow-dirty + --allow-staged on clippy) force-fix: && format @@ -23,7 +23,25 @@ fix: && format test: cargo test -check: test lint +rust-check: test lint + +ci-check: + actionlint + +check: + rust-check + +pre-commit: + #!/usr/bin/env sh + newfiles=$(git status --porcelain | awk '{ print $2 }') + if (echo $newfiles | grep ".rs" ); then + just rust-check + fi + if (echo $newfiles | grep ".github" ); then + just ci-check + fi +# TODO: do this with other languages +# TODO: make this only do stuff for the specific rust directories modified _install program command: #!/usr/bin/env sh