toolkit check pr does same clippy checks as github CI (#10528)

Align the clippy checks done by `toolkit check pr` with the ones done by
github CI when you post a PR.
Motivated in no small part by my frustration at having the third PR in
one day fail due to a lint that `toolkit check pr` didn't find!

# Description
Change definition of `toolkit clippy` 
* always run checks on all crates in the workspace
* always run checks on tests as well as non-test code
* don't check for `unwrap_used`. There are many (legit) uses of
`.unwrap()` in tests,
* 
# User-Facing Changes
Changes to `toolkit clippy`:
* remove `--workspace` switch
* `--features` is no longer mutually exclusive with `--workspace`

# Tests + Formatting
n/a

# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->

---------

Co-authored-by: amtoine <stevan.antoine@gmail.com>
This commit is contained in:
Bob Hyman 2023-09-29 10:51:19 -07:00 committed by GitHub
parent 9e445fd4c5
commit c64017de7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,27 +34,19 @@ export def fmt [
export def clippy [
--verbose # print extra information about the command's progress
--features: list<string> # the list of features to run *Clippy* on
--workspace # run the *Clippy* command on the whole workspace (overrides `--features`)
] {
if $verbose {
print $"running ('toolkit clippy' | pretty-format-command)"
}
try {
if $workspace {(
cargo clippy
--workspace
--
-D warnings
-D clippy::unwrap_used
)} else {(
cargo clippy
--features ($features | str join ",")
--
-D warnings
-D clippy::unwrap_used
)}
} catch {
try {(
cargo clippy
--workspace
--tests
--features ($features | str join ",")
--
-D warnings
)} catch {
error make --unspanned {
msg: $"\nplease fix the above ('clippy' | pretty-format-command) errors before continuing!"
}