Skip to content

Commit

Permalink
Export Clippy results as SARIF and upload (#633)
Browse files Browse the repository at this point in the history
## Type of change

```
- [ ] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [X] Build/deploy pipeline (DevOps)
- [ ] Other
```

## Objective

Takes Clippy results as SARIF and uploads to GHAS for easier viewing and
management.

## Code changes

- **.github/workflows/lint.yml:** New Cargo package usage and SARIF
upload.

## Before you submit

- Please add **unit tests** where it makes sense to do so

---------

Co-authored-by: Hinton <hinton@users.noreply.github.com>
  • Loading branch information
withinfocus and Hinton authored Feb 27, 2024
1 parent cdfb9fa commit 4e45626
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ jobs:
- name: Cargo fmt
run: cargo +nightly fmt --check

- name: Install clippy-sarif and sarif-fmt
run: cargo install clippy-sarif sarif-fmt --locked --git https://github.com/psastras/sarif-rs.git --rev 11c33a53f6ffeaed736856b86fb6b7b09fabdfd8

- name: Cargo clippy
run: cargo clippy --all-features --tests --message-format=json |
clippy-sarif | tee clippy_result.sarif | sarif-fmt
env:
RUSTFLAGS: "-D warnings"

- name: Upload Clippy results to GitHub
uses: github/codeql-action/upload-sarif@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
with:
sarif_file: clippy_result.sarif

- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
Expand All @@ -52,8 +66,3 @@ jobs:
run: cargo doc --no-deps --features internal
env:
RUSTDOCFLAGS: "-D warnings"

- name: Cargo clippy
run: cargo clippy --all-features --tests
env:
RUSTFLAGS: "-D warnings"

0 comments on commit 4e45626

Please sign in to comment.