Skip to content

Instantly share code, notes, and snippets.

@beeb
Last active December 14, 2023 13:09
Show Gist options
  • Save beeb/6fd3bfd69589418a4de8a70cda01dda7 to your computer and use it in GitHub Desktop.
Save beeb/6fd3bfd69589418a4de8a70cda01dda7 to your computer and use it in GitHub Desktop.
Generate slither warnings in GitHub Actions instead of erroring
name: CI
on:
pull_request:
jobs:
run-slither:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install slither
run: pip3 install slither-analyzer
- name: Run slither
run: |
slither --fail-none --json - . | jq '.results.detectors[] | .elements[0].source_mapping as $src | "::\( if .impact == "High" then "error" elif .impact == "Medium" then "warning" else "notice" end ) file=\( $src.filename_relative ),col=\( $src.starting_column ),endColumn=\( $src.ending_column ),line=\( $src.lines[0] )\( if $src.lines[0] == $src.lines[-1] then "" else ",endLine=" + "\( $src.lines[-1] )" end )::\( .description )"' | xargs -n1 echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment