Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add rust linting commands to scripts-dev/lint.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Jan 11, 2023
1 parent 8efaa00 commit 309a223
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts-dev/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,27 @@ python3 -m black "${files[@]}"
# --quiet suppresses the update check.
ruff --quiet "${files[@]}"

# Catch any common programming mistakes in Rust code.
#
# --bins, --examples, --lib, --tests combined explicitly disable checking
# the benchmarks, which can fail on the stable rust toolchain.
#
# --allow-staged and --allow-dirty suppress clippy raising errors
# for uncommitted files. Only needed when using --fix.
#
# -D warnings disables the "warnings" lint.
#
# Using --fix has a tendency to cause subsequent runs of clippy to recompile
# rust code, which can slow down this script. Thus we run clippy without --fix
# first which is quick, and then re-run it with --fix if an error was found.
if ! cargo-clippy --bins --examples --lib --tests -- -D warnings > /dev/null 2>&1; then
cargo-clippy \
--bins --examples --lib --tests --allow-staged --allow-dirty --fix -- -D warnings
fi

# Ensure the formatting of Rust code.
cargo-fmt

# Ensure all Pydantic models use strict types.
./scripts-dev/check_pydantic_models.py lint

Expand Down

0 comments on commit 309a223

Please sign in to comment.