Skip to content

Commit

Permalink
Match toolkit.nu clippy settings to CI clippy settings
Browse files Browse the repository at this point in the history
  • Loading branch information
drbrain committed Nov 7, 2023
1 parent 15c765d commit b34ae1f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ name: continuous-integration
env:
NUSHELL_CARGO_PROFILE: ci
NU_LOG_LEVEL: DEBUG
# If changing these settings also change toolkit.nu
CLIPPY_OPTIONS: "-D warnings -D clippy::unwrap_used"

jobs:
Expand Down Expand Up @@ -47,9 +48,10 @@ jobs:
- name: cargo fmt
run: cargo fmt --all -- --check

# If changing these settings also change toolkit.nu
- name: Clippy
run: cargo clippy --workspace ${{ matrix.flags }} --exclude nu_plugin_* -- $CLIPPY_OPTIONS

# In tests we don't have to deny unwrap
- name: Clippy of tests
run: cargo clippy --tests --workspace ${{ matrix.flags }} --exclude nu_plugin_* -- -D warnings
Expand Down
30 changes: 28 additions & 2 deletions toolkit.nu
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,41 @@ export def clippy [
print $"running ('toolkit clippy' | pretty-format-command)"
}

# If changing these settings also change CI settings in .github/workflows/ci.yml
try {(
cargo clippy
--workspace
--features ($features | str join ",")
--
-D warnings
-D clippy::unwrap_used
)

if $verbose {
print $"running ('toolkit clippy' | pretty-format-command) on tests"
}
# In tests we don't have to deny unwrap
(
cargo clippy
--tests
--workspace
--features ($features | str join ",")
--
-D warnings
-D clippy::unwrap_used
)} catch {
)

if $verbose {
print $"running ('toolkit clippy' | pretty-format-command) on plugins"
}
(
cargo clippy
--package nu_plugin_*
--
-D warnings
-D clippy::unwrap_used
)

} catch {
error make --unspanned {
msg: $"\nplease fix the above ('clippy' | pretty-format-command) errors before continuing!"
}
Expand Down

0 comments on commit b34ae1f

Please sign in to comment.