Skip to content

Commit

Permalink
ci: Run rustfmt on changed files
Browse files Browse the repository at this point in the history
  • Loading branch information
NickeZ committed Sep 20, 2024
1 parent d966071 commit 9ee9b35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .ci/check-style
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set -e
set -o pipefail

CLANGFORMAT=${CLANGFORMAT:-clang-format-18}
RUSTFMT=${RUSTFMT:-rustfmt}

command -v git >/dev/null 2>&1 || { echo >&2 "git is missing"; exit 1; }
command -v xargs >/dev/null 2>&1 || { echo >&2 "xargs is missing"; exit 1; }
Expand Down Expand Up @@ -37,3 +38,9 @@ if git --no-pager diff --diff-filter=d --name-only ${TARGET_BRANCH} HEAD | grep
git --no-pager diff
exit 1
fi

RUST_SOURCES=$(git --no-pager diff --diff-filter=d --name-only ${TARGET_BRANCH} HEAD | grep -E "^src/rust.*\.rs\$" | grep -v -E "^src/rust/vendor" || true)
if [ -n "$RUST_SOURCES" ] ; then
echo $RUST_SOURCES
"$RUSTFMT" --check $RUST_SOURCES
fi
2 changes: 1 addition & 1 deletion .ci/ci
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
# Deny warnings in rust. CI will fail to compile any code with warnings in it.
export RUSTFLAGS="-Dwarnings"

# Check style for C
# Check style for C and Rust
./.ci/check-style

# Check that we can generate protobuf definitions for python
Expand Down

0 comments on commit 9ee9b35

Please sign in to comment.