mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-09 03:57:24 +00:00
tools: Add --platform arg to tools/clippy
BUG=b:257249038 TEST=CQ Change-Id: Ife9a917b82508a97beda6c50e8d3d71dccfa520d Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4000811 Reviewed-by: Dennis Kempin <denniskempin@google.com> Commit-Queue: Vikram Auradkar <auradkar@google.com>
This commit is contained in:
parent
4eae67aaec
commit
90a92c697d
1 changed files with 15 additions and 9 deletions
24
tools/clippy
24
tools/clippy
|
@ -9,21 +9,26 @@
|
|||
# To fix violations where possible:
|
||||
# $ ./tools/clippy --fix
|
||||
|
||||
from impl.common import CROSVM_ROOT, cwd, run_main, cmd, chdir
|
||||
from typing import List
|
||||
from impl.common import CROSVM_ROOT, run_main, cmd, chdir
|
||||
from impl.test_runner import get_workspace_excludes
|
||||
from impl.test_target import Triple
|
||||
from impl.test_target import Triple, SHORTHANDS
|
||||
|
||||
clippy = cmd("cargo clippy").with_color_flag()
|
||||
triple = Triple.host_default()
|
||||
|
||||
excluded_crates: list[str] = list(get_workspace_excludes(triple))
|
||||
|
||||
|
||||
def is_crate_excluded(crate: str) -> bool:
|
||||
return crate in excluded_crates
|
||||
def main(
|
||||
fix: bool = False,
|
||||
json: bool = False,
|
||||
locked: bool = False,
|
||||
platform: str = None,
|
||||
):
|
||||
try:
|
||||
triple: Triple = Triple.from_shorthand(platform) if platform else Triple.host_default()
|
||||
except Exception as e:
|
||||
raise type(e)(str(e) + f"\nValid platforms are {', '.join(SHORTHANDS.keys())}")
|
||||
excluded_crates: List[str] = list(get_workspace_excludes(triple))
|
||||
|
||||
|
||||
def main(fix: bool = False, json: bool = False, locked: bool = False):
|
||||
chdir(CROSVM_ROOT)
|
||||
|
||||
# Note: Clippy checks are configured in .cargo/config.toml
|
||||
|
@ -32,6 +37,7 @@ def main(fix: bool = False, json: bool = False, locked: bool = False):
|
|||
"--message-format=json" if json else None,
|
||||
"--locked" if locked else None,
|
||||
"--all-targets",
|
||||
"--no-default-features" if triple.sys == "windows" else None,
|
||||
"--",
|
||||
"-Dwarnings",
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue