crosvm/tools/clippy
Dennis Kempin d9af9d6a58 clippy: Fix aarch64 and crosvm-fuzz
Add proper conditional compilation flags. This will largely still skip
most of those crates, but at least the syntax will be checked.

BUG=b:192373803
TEST=./tools/clippy

Change-Id: I66d29ccdfec01f3a83b682a9cc135188fdc830cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3438705
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-04 19:16:05 +00:00

48 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# To check for violations:
# $ ./tools/clippy
#
# To fix violations where possible:
# $ ./tools/clippy --fix
set -e
cd "$(dirname $0)/.."
# TODO(b/192373803): Clean up clippy error is the following crates
EXCLUDE=(
devices # 92 errors
disk # 36 errors
kvm # 641 errors
kvm_sys # 613 errors
libvda # 79 errors
net_sys # 3 errors
virtio_sys # 9 errors
x86_64 # 56 errors
)
EXCLUDE_COMMON=(
common/cros_async # 8 errors
)
# Note: Clippy checks are configured in .cargo/config.toml
echo "Clippy crosvm workspace"
cargo clippy \
--workspace \
--features all-linux \
--all-targets \
${EXCLUDE[@]/#/--exclude } \
"$@" -- -Dwarnings
for crate in common/*; do
if [ -d "${crate}" ] &&
[[ ! " ${EXCLUDE_COMMON[*]} " =~ " ${crate} " ]]; then
echo ""
echo "Clippy ${crate}"
(cd "${crate}" &&
cargo clippy --all-targets --all-features "$@" -- -Dwarnings)
fi
done