Skip to content

Commit

Permalink
Move Rust clippy from formatting to test script (#251)
Browse files Browse the repository at this point in the history
It needs to build the code anyways, and it gets already built in the
testing phase anyways, so running clippy after tests is essentially
instantaneous.

This way the format script does purely syntactic checks and it is much
faster to return errors if there are any.
  • Loading branch information
tiziano88 authored Oct 7, 2019
1 parent a510363 commit e366a8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 0 additions & 4 deletions scripts/check_formatting
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,3 @@ find scripts -type f -exec shellcheck {} +
# Fortunately, rustfmt has the --check option that will make it exit with 1
# if formatting has to be applied.
find examples rust -type f -name '*.rs' -exec rustfmt --check {} +

# Run clippy to lint the Rust code.
cargo clippy --manifest-path="$PWD/examples/Cargo.toml" --all-targets -- -D warnings
cargo clippy --manifest-path="$PWD/rust/Cargo.toml" --all-targets -- -D warnings
11 changes: 9 additions & 2 deletions scripts/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ set -o errexit
set -o nounset
set -o xtrace

cargo test --manifest-path=./rust/Cargo.toml
cargo test --manifest-path=./examples/Cargo.toml
# For each Rust workspace, first run tests, then run clippy, turning warnings into errors.
# See https://github.com/rust-lang/rust-clippy.

cargo test --all-targets --manifest-path=./rust/Cargo.toml
cargo clippy --all-targets --manifest-path=./rust/Cargo.toml -- --deny=warnings

cargo test --all-targets --manifest-path=./examples/Cargo.toml
cargo clippy --all-targets --manifest-path=./examples/Cargo.toml -- --deny=warnings

bazel test --test_output=all //oak/server:host_tests //oak/server/storage:host_tests //oak/common:host_tests

0 comments on commit e366a8a

Please sign in to comment.