From b2fc0c2712b1f41554b58eb6cc98ecfc03f6ed2f Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Wed, 29 Jan 2025 10:29:10 -0500 Subject: [PATCH] add clippy-sarif for pretty clippy output integrated with github --- .github/workflows/lint-ffi-bindings.yaml | 11 +++++++++-- .github/workflows/lint-node-bindings.yaml | 11 +++++++++-- .github/workflows/lint-wasm-bindings.yaml | 11 +++++++++-- .github/workflows/lint-workspace.yaml | 11 +++++++++-- .github/workflows/test-ffi-bindings.yml | 2 +- .github/workflows/test-http-api.yml | 2 +- .github/workflows/test-webassembly.yml | 2 +- .github/workflows/test-workspace.yml | 2 +- common/src/wasm.rs | 3 --- 9 files changed, 40 insertions(+), 15 deletions(-) diff --git a/.github/workflows/lint-ffi-bindings.yaml b/.github/workflows/lint-ffi-bindings.yaml index 6b4a7c35f..bf4212009 100644 --- a/.github/workflows/lint-ffi-bindings.yaml +++ b/.github/workflows/lint-ffi-bindings.yaml @@ -11,7 +11,7 @@ on: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 - RUSTFLAGS: -D warnings + RUSTFLAGS: -D warnings --cfg tracing_unstable CARGO_PROFILE_TEST_DEBUG: 0 jobs: lint: @@ -22,6 +22,9 @@ jobs: uses: actions/checkout@v4 - name: Update rust toolchains run: rustup update + - uses: taiki-e/install-action@v2 + with: + tool: clippy-sarif,sarif-fmt - name: Cache uses: Swatinem/rust-cache@v2 with: @@ -29,6 +32,10 @@ jobs: . bindings_ffi - name: Run clippy and fail on warnings - run: cargo clippy --locked --manifest-path bindings_ffi/Cargo.toml --all-features --all-targets --no-deps + run: cargo clippy --locked --manifest-path bindings_ffi/Cargo.toml --all-features --all-targets --no-deps --message-format=json | clippy-sarif | tee results.sarif | sarif-fmt + - name: Upload SARIF file + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: results.sarif - name: Run format check run: cargo fmt --manifest-path bindings_ffi/Cargo.toml --check diff --git a/.github/workflows/lint-node-bindings.yaml b/.github/workflows/lint-node-bindings.yaml index 8851b6b58..1eb5d9c45 100644 --- a/.github/workflows/lint-node-bindings.yaml +++ b/.github/workflows/lint-node-bindings.yaml @@ -8,7 +8,7 @@ on: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 - RUSTFLAGS: -D warnings + RUSTFLAGS: -D warnings --cfg tracing_unstable CARGO_PROFILE_TEST_DEBUG: 0 jobs: lint: @@ -19,6 +19,9 @@ jobs: uses: actions/checkout@v4 - name: Update rust toolchains run: rustup update + - uses: taiki-e/install-action@v2 + with: + tool: clippy-sarif,sarif-fmt - name: Cache uses: Swatinem/rust-cache@v2 with: @@ -26,7 +29,11 @@ jobs: . bindings_node - name: Run clippy and fail on warnings - run: cargo clippy --locked --manifest-path bindings_node/Cargo.toml --all-features --all-targets --no-deps + run: cargo clippy --locked --manifest-path bindings_node/Cargo.toml --all-features --all-targets --no-deps --message-format=json | clippy-sarif | tee results.sarif | sarif-fmt + - name: Upload SARIF file + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: results.sarif - name: Run format check run: cargo fmt --manifest-path bindings_node/Cargo.toml --check - name: Setup node diff --git a/.github/workflows/lint-wasm-bindings.yaml b/.github/workflows/lint-wasm-bindings.yaml index f19c67e85..0c1db8915 100644 --- a/.github/workflows/lint-wasm-bindings.yaml +++ b/.github/workflows/lint-wasm-bindings.yaml @@ -8,7 +8,7 @@ on: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 - RUSTFLAGS: -D warnings + RUSTFLAGS: -D warnings --cfg tracing_unstable CARGO_PROFILE_TEST_DEBUG: 0 jobs: lint: @@ -19,12 +19,19 @@ jobs: uses: actions/checkout@v4 - name: Update rust toolchains run: rustup update + - uses: taiki-e/install-action@v2 + with: + tool: clippy-sarif,sarif-fmt - name: Cache uses: Swatinem/rust-cache@v2 with: workspaces: | bindings_wasm - name: Run clippy and fail on warnings - run: cargo clippy --manifest-path bindings_wasm/Cargo.toml --all-features --target wasm32-unknown-unknown --no-deps + run: cargo clippy --locked --manifest-path bindings_wasm/Cargo.toml --all-features --target wasm32-unknown-unknown --no-deps --message-format=json | clippy-sarif | tee results.sarif | sarif-fmt + - name: Upload SARIF file + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: results.sarif - name: Run format check run: cargo fmt --manifest-path bindings_wasm/Cargo.toml --check diff --git a/.github/workflows/lint-workspace.yaml b/.github/workflows/lint-workspace.yaml index c80697d35..1c5e8365d 100644 --- a/.github/workflows/lint-workspace.yaml +++ b/.github/workflows/lint-workspace.yaml @@ -22,7 +22,7 @@ on: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 - RUSTFLAGS: -D warnings + RUSTFLAGS: -D warnings --cfg tracing_unstable CARGO_PROFILE_TEST_DEBUG: 0 jobs: lint: @@ -33,6 +33,9 @@ jobs: uses: actions/checkout@v4 - name: Update rust toolchains run: rustup update + - uses: taiki-e/install-action@v2 + with: + tool: clippy-sarif,sarif-fmt - name: Cache uses: Swatinem/rust-cache@v2 with: @@ -40,6 +43,10 @@ jobs: . - name: Run clippy and fail on warnings # Exclude bindings_wasm since it only compiles for wasm32 - run: cargo clippy --locked --workspace --all-features --all-targets --no-deps --exclude bindings_wasm + run: cargo clippy --locked --workspace --all-features --all-targets --no-deps --exclude bindings_wasm --message-format=json | clippy-sarif | tee results.sarif | sarif-fmt + - name: Upload SARIF file + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: results.sarif - name: Run format check run: cargo fmt --check diff --git a/.github/workflows/test-ffi-bindings.yml b/.github/workflows/test-ffi-bindings.yml index 5c576498b..ad411f614 100644 --- a/.github/workflows/test-ffi-bindings.yml +++ b/.github/workflows/test-ffi-bindings.yml @@ -22,7 +22,7 @@ on: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 - RUSTFLAGS: -D warnings + RUSTFLAGS: -D warnings --cfg tracing_unstable CARGO_PROFILE_TEST_DEBUG: 0 jobs: test: diff --git a/.github/workflows/test-http-api.yml b/.github/workflows/test-http-api.yml index 610e8b380..ae9717066 100644 --- a/.github/workflows/test-http-api.yml +++ b/.github/workflows/test-http-api.yml @@ -21,7 +21,7 @@ on: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 - RUSTFLAGS: -D warnings + RUSTFLAGS: -D warnings --cfg tracing_unstable CARGO_PROFILE_TEST_DEBUG: 0 jobs: test: diff --git a/.github/workflows/test-webassembly.yml b/.github/workflows/test-webassembly.yml index c7e4c54ac..1470ef446 100644 --- a/.github/workflows/test-webassembly.yml +++ b/.github/workflows/test-webassembly.yml @@ -17,7 +17,7 @@ on: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 - RUSTFLAGS: -D warnings + RUSTFLAGS: -D warnings --cfg tracing_unstable CARGO_PROFILE_TEST_DEBUG: 0 WASM_BINDGEN_TEST_TIMEOUT: 240 WASM_BINDGEN_TEST_ONLY_WEB: 1 diff --git a/.github/workflows/test-workspace.yml b/.github/workflows/test-workspace.yml index 0df941f2c..3295d7307 100644 --- a/.github/workflows/test-workspace.yml +++ b/.github/workflows/test-workspace.yml @@ -21,7 +21,7 @@ on: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 - RUSTFLAGS: -D warnings + RUSTFLAGS: -D warnings --cfg tracing_unstable CARGO_PROFILE_TEST_DEBUG: 0 jobs: test: diff --git a/common/src/wasm.rs b/common/src/wasm.rs index a839e53f9..d35824ac5 100644 --- a/common/src/wasm.rs +++ b/common/src/wasm.rs @@ -1,9 +1,6 @@ use futures::{FutureExt, Stream, StreamExt}; use std::{future::Future, pin::Pin, task::Poll}; -#[cfg(target_arch = "wasm32")] -use wasm_bindgen::prelude::*; - /// Global Marker trait for WebAssembly #[cfg(target_arch = "wasm32")] pub trait Wasm {}