Skip to content

Commit

Permalink
add clippy-sarif for pretty clippy output integrated with github
Browse files Browse the repository at this point in the history
  • Loading branch information
insipx committed Jan 29, 2025
1 parent b4127f2 commit b2fc0c2
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 15 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/lint-ffi-bindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -22,13 +22,20 @@ 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_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
11 changes: 9 additions & 2 deletions .github/workflows/lint-node-bindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -19,14 +19,21 @@ 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_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
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/lint-wasm-bindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
11 changes: 9 additions & 2 deletions .github/workflows/lint-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -33,13 +33,20 @@ 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: |
.
- 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
2 changes: 1 addition & 1 deletion .github/workflows/test-ffi-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-http-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-webassembly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 0 additions & 3 deletions common/src/wasm.rs
Original file line number Diff line number Diff line change
@@ -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 {}
Expand Down

0 comments on commit b2fc0c2

Please sign in to comment.